Part Number Hot Search : 
HT13R90 B2612BS1 DMC2048 STP40NF MGB31DH AD7548BQ SA58646 RFM01U7P
Product Description
Full Text Search
 

To Download PIC16C771T-ESS Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  ? 2002 microchip technology inc. ds41120b pic16c717/770/771 data sheet 18/20-pin, 8-bit cmos microcontrollers with 10/12-bit a/d m
ds41120b - page ii ? 2002 microchip technology inc. information contained in this publication regarding device applications and the like is intended through suggestion only and may be superseded by updates. it is your responsibility to ensure that your application meets with your specifications. no representation or warranty is given and no liability is assumed by microchip technology incorporated with respect to the accuracy or use of such information, or infringement of patents or other intellectual property rights arising from such use or otherwise. use of microchip?s products as critical com- ponents in life support systems is not authorized except with express written approval by microchip. no licenses are con- veyed, implicitly or otherwise, under any intellectual property rights. trademarks the microchip name and logo, the microchip logo, filterlab, k ee l oq , mplab, pic, picmicro, picmaster, picstart, pro mate, seeval and the embedded control solutions company are registered trademarks of microchip technology incorporated in the u.s.a. and other countries. dspic, economonitor, fansense, flexrom, fuzzylab, in-circuit serial programming, icsp, icepic, microid, microport, migratable memory, mpasm, mplib, mplink, mpsim, mxdev, picc, picdem, picdem.net, rfpic, select mode and total endurance are trademarks of microchip technology incorporated in the u.s.a. serialized quick term programming (sqtp) is a service mark of microchip technology incorporated in the u.s.a. all other trademarks mentioned herein are property of their respective companies. ? 2002, microchip technology incorporated, printed in the u.s.a., all rights reserved. printed on recycled paper. microchip received qs-9000 quality system certification for its worldwide headquarters, design and wafer fabrication facilities in chandler and tempe, arizona in july 1999. the company?s quality system processes and procedures are qs-9000 compliant for its picmicro ? 8-bit mcus, k ee l oq ? code hopping devices, serial eeproms and microperipheral products. in addition, microchip ? s quality system for the design and manufacture of development systems is iso 9001 certified. note the following details of the code protection feature on picmicro ? mcus.  the picmicro family meets the specifications contained in the microchip data sheet.  microchip believes that its family of picmicro microcontrollers is one of the most secure products of its kind on the market to day, when used in the intended manner and under normal conditions.  there are dishonest and possibly illegal methods used to breach the code protection feature. all of these methods, to our knowl - edge, require using the picmicro microcontroller in a manner outside the operating specifications contained in the data sheet. the person doing so may be engaged in theft of intellectual property.  microchip is willing to work with the customer who is concerned about the integrity of their code.  neither microchip nor any other semiconductor manufacturer can guarantee the security of their code. code protection does not mean that we are guaranteeing the product as ? unbreakable ? .  code protection is constantly evolving. we at microchip are committed to continuously improving the code protection features of our product. if you have any further questions about this matter, please contact the local sales office nearest to you.
? 2002 microchip technology inc. ds41120b-page 1 m pic16c717/770/771 18/20-pin, 8-bit cmos microcontrollers with 10/12-bit a/d microcontroller core features:  high-performance risc cpu  only 35 single word instructions to learn  all single cycle instructions except for program branches which are two cycle  operating speed: dc - 20 mhz clock input dc - 200 ns instruction cycle  interrupt capability (up to 10 internal/external interrupt sources)  eight level deep hardware stack  direct, indirect and relative addressing modes  power-on reset (por)  power-up timer (pwrt) and oscillator start-up timer (ost)  watchdog timer (wdt) with its own on-chip rc oscillator for reliable operation  selectable oscillator options: - intrc - internal rc, dual speed (4 mhz and 37 khz nominal) dynamically switchable for power savings - er - external resistor, dual speed (user selectable frequency and 37 khz nominal) dynamically switchable for power savings - ec - external clock - hs - high speed crystal/resonator - xt - crystal/resonator - lp - low power crystal  low power, high speed cmos eprom technology  in-circuit serial programming ? (icsp ? )  wide operating voltage range: 2.5v to 5.5v  15 i/o pins with individual control for: - direction (15 pins) - digital/analog input (6 pins) - portb interrupt on change (8 pins) - portb weak pull-up (8 pins) - high voltage open drain (1 pin)  commercial and industrial temperature ranges  low power consumption: - < 2 ma @ 4v, 4 mhz -11 a typical @ 2.5v, 37 khz -< 1 a typical standby current pin diagram peripheral features:  timer0: 8-bit timer/counter with 8-bit prescaler  timer1: 16-bit timer/counter with prescaler, can be incremented during sleep via external crystal/clock  timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler  enhanced capture, compare, pwm (eccp) module - capture is 16-bit, max. resolution is 12.5 ns - compare is 16-bit, max. resolution is 200 ns - pwm max. resolution is 10-bit - enhanced pwm: - single, half-bridge and full-bridge output modes - digitally programmable deadband delay  analog-to-digital converter: - pic16c770/771 12-bit resolution - pic16c717 10-bit resolution  on-chip absolute bandgap voltage reference generator  programmable brown-out reset (pbor) circuitry  programmable low-voltage detection (plvd) circuitry  master synchronous serial port (mssp) with two modes of operation: -3-wire spi ? (supports all 4 spi modes) -i 2 c ? compatible including master mode support  program memory read (pmr) capability for look- up table, character string storage and checksum calculation purposes device memory pins a/d resolution a/d channels program x14 data x8 pic16c717 2k 256 18, 20 10 bits 6 pic16c770 2k 256 20 12 bits 6 pic16c771 4k 256 20 12 bits 6 rb3/ccp1/p1a rb2/sck/scl ra7/osc1/clkin ra6/osc2/clkout v dd rb7/t1osi/p1d rb6/t1oso/t1cki/p1c rb5/sdo/p1b rb4/sdi/sda ra0/an0 ra1/an1/lvdin ra4/t0cki ra5/mclr /v pp v ss ra2/an2/v ref -/vrl ra3/an3/v ref +/vrh rb0/an4/int rb1/an5/ss 1 2 3 4 5 6 7 8 9 20 19 18 17 16 15 14 13 12 a vdd a vss 10 11 pic16c770/771 20-pin pdip, soic, ssop
pic16c717/770/771 ds41120b-page 2 ? 2002 microchip technology inc. pin diagrams 18-pin pdip, soic rb3/ccp1/p1a rb2/sck/scl ra7/osc1/clkin ra6/osc2/clkout v dd rb7/t1osi/p1d rb6/t1oso/t1cki/p1c rb5/sdo/p1b rb4/sdi/sda ra0/an0 ra1/an1/lvdin ra4/t0cki ra5/mclr /v pp v ss ra2/an2/v ref -/vrl ra3/an3/v ref +/vrh rb0/an4/int rb1/an5/ss 1 2 3 4 5 6 7 8 9 18 17 16 15 14 13 12 11 10 pic16c717 rb3/ccp1/p1a rb2/sck/scl ra7/osc1/clkin ra6/osc2/clkout v dd (2) rb7/t1osi/p1d rb6/t1oso/t1cki/p1c rb5/sdo/p1b rb4/sdi/sda ra0/an0 ra1/an1/lvdin ra4/t0cki ra5/mclr /v pp v ss (1) ra2/an2/v ref -/vrl ra3/an3/v ref +/vrh rb0/an4/int rb1/an5/ss 1 2 3 4 5 6 7 8 9 20 19 18 17 16 15 14 13 12 pic16c717 v dd (2) v ss (1) 10 11 20-pin ssop note 1: v ss pins 5 and 6 must be tied together. 2: v dd pins 15 and 16 must be tied together. key features picmicro tm mid-range mcu family reference manual, (ds33023) pic16c717 pic16c770 pic16c771 operating frequency dc - 20 mhz dc - 20 mhz dc - 20 mhz resets (and delays) por, bor, mclr , wdt (pwrt, ost) por, bor, mclr , wdt (pwrt, ost) por, bor, mclr , wdt (pwrt, ost) program memory (14-bit words) 2k 2k 4k data memory (bytes) 256 256 256 interrupts 10 10 10 i/o ports ports a,b ports a,b ports a,b timers 333 enhanced capture/compare/pwm (eccp) modules 111 serial communications mssp mssp mssp 12-bit analog-to-digital module ? 6 input channels 6 input channels 10-bit analog-to-digital module 6 input channels ?? instruction set 35 instructions 35 instructions 35 instructions
? 2002 microchip technology inc. ds41120b-page 3 pic16c717/770/771 table of contents 1.0 device overview ........................................................................................................... ........................................... 5 2.0 memory organization....................................................................................................... ........................................ 9 3.0 i/o ports................................................................................................................. ................................................ 25 4.0 program memory read (pmr) ................................................................................................. ............................. 41 5.0 timer0 module ............................................................................................................. .......................................... 45 6.0 timer1 module ............................................................................................................. .......................................... 47 7.0 timer2 module ............................................................................................................. .......................................... 51 8.0 enhanced capture/compare/pwm (eccp) modules............................................................................... ............. 53 9.0 master synchronous serial port (mssp) module .............................................................................. .................... 65 10.0 voltage reference module and low-voltage detect.......................................................................... ................ 101 11.0 analog-to-digital converter (a/d) module................................................................................. ......................... 105 12.0 special features of the cpu .............................................................................................. ............................... 117 13.0 instruction set summary.................................................................................................. .................................. 133 14.0 development support ...................................................................................................... .................................. 141 15.0 electrical characteristics............................................................................................... ..................................... 147 16.0 dc and ac characteristics graphs and tables.............................................................................. ................... 179 17.0 packaging information .................................................................................................... ................................... 197 appendix a: revision history .................................................................................................. ............................. 207 appendix b: device differences ................................................................................................. ........................... 208 index ......................................................................................................................... ................................................. 209 on-line support................................................................................................................ .......................................... 215 reader response ................................................................................................................ ....................................... 216 pic16c717/770/771 product identification system ................................................................................ .................... 217 to our valued customers it is our intention to provide our valued customers with the best documentation possible to ensure successful use of your micro chip products. to this end, we will continue to improve our publications to better suit your needs. our publications will be refined and enhanced as new volumes and updates are introduced. if you have any questions or comments regarding this publication, please contact the marketing communications department via e-mail at docerrors@mail.microchip.com or fax the reader response form in the back of this data sheet to (480) 792-4150. we welcome your feedback. most current data sheet to obtain the most up-to-date version of this data sheet, please register at our worldwide web site at: http://www.microchip.com you can determine the version of a data sheet by examining its literature number found on the bottom outside corner of any page . the last character of the literature number is the version number, (e.g., ds30000a is version a of document ds30000). errata an errata sheet, describing minor operational differences from the data sheet and recommended workarounds, may exist for curren t devices. as device/documentation issues become known to us, we will publish an errata sheet. the errata will specify the revisi on of silicon and revision of document to which it applies. to determine if an errata sheet exists for a particular device, please check with one of the following:  microchip ? s worldwide web site; http://www.microchip.com  your local microchip sales office (see last page)  the microchip corporate literature center; u.s. fax: (480) 792-7277 when contacting a sales office or the literature center, please specify which device, revision of silicon and data sheet (inclu de liter- ature number) you are using. customer notification system register on our web site at www.microchip.com/cn to receive the most current information on all of our products.
pic16c717/770/771 ds41120b-page 4 ? 2002 microchip technology inc. notes:
? 2002 microchip technology inc. ds41120b-page 5 pic16c717/770/771 1.0 device overview this document contains device-specific information. additional information may be found in the picmicro tm mid-range mcu family reference manual, (ds33023), which may be obtained from your local microchip sales representative or downloaded from the microchip website. the reference manual should be considered a complementary document to this data sheet, and is highly recommended reading for a better understanding of the device architecture and operation of the peripheral modules. there are three devices (pic16c717, pic16c770 and pic16c771) covered by this data sheet. the pic16c717 device comes in 18/20-pin packages and the pic16c770/771 devices come in 20-pin packages. the following two figures are device block diagrams of the pic16c717 and the pic16c770/771. figure 1-1: pic16c717 block diagram eprom program memory 2k x 14 13 data bus 8 14 program bus instruction reg program counter 8 level stack (13-bit) ram file registers 256 x 8 direct addr 7 addr (1) 9 addr mux indirect addr fsr reg status reg mux alu w reg power-up timer oscillator start-up timer power-on reset watchdog timer instruction decode & control osc1/clkin osc2/clkout v dd , v ss porta portb ra4/t0cki rb0/an4/int rb4/sdi/sda 8 8 brown-out reset note 1: higher order bits are from the status register. enhanced ccp master timer0 timer1 timer2 synchronous ra3/an3/v ref +/vrh ra2/an2/v ref -/vrl ra1/an1/lvdin ra0/an0 8 3 timing generation 10-bit adc rb1/an5/ss rb2/sck/scl rb3/ccp1/p1a ra5/mclr /v pp ra6/osc2/clkout ra7/osc1/clkin rb5/sdo/p1b rb6/t1oso/t1cki/p1c rb7/t1osi/p1d internal 4 mhz, 37 khz and er mode (eccp) serial port (mssp) bandgap reference low-voltage detect ram program memory read (pmr)
pic16c717/770/771 ds41120b-page 6 ? 2002 microchip technology inc. figure 1-2: pic16c770/771 block diagram eprom program memory (2) 13 data bus 8 14 program bus instruction reg program counter 8 level stack (13-bit) ram file registers 256 x 8 direct addr 7 addr (1) 9 addr mux indirect addr fsr reg status reg mux alu w reg power-up timer oscillator start-up timer power-on reset watchdog timer instruction decode & control osc1/clkin osc2/clkout v dd , v ss porta portb ra4/t0cki rb0/an4/int rb4/sdi/sda 8 8 brown-out reset note 1: higher order bits are from the status register. 2: program memory for pic16c770 is 2k x 14. program memory for pic16c771 is 4k x 14. enhanced ccp master timer0 timer1 timer2 synchronous ra3/an3/v ref +/vrh ra2/an2/v ref -/vrl ra1/an1/lvdin ra0/an0 8 3 timing generation 12-bit adc rb1/an5/ss rb2/sck/scl rb3/ccp1/p1a ra5/mclr /v pp ra6/osc2/clkout ra7/osc1/clkin rb5/sdo/p1b rb6/t1oso/t1cki/p1c rb7/t1osi/p1d internal 4 mhz, 37 khz and er mode (eccp) serial port (mssp) bandgap reference low-voltage detect ram program memory read (pmr) av dd av ss
? 2002 microchip technology inc. ds41120b-page 7 pic16c717/770/771 table 1-1: pic16c717/770/771 pinout description name function input type output type description ra0/an0 ra0 st cmos bi-directional i/o an0 an a/d input ra1/an1/lvdin ra1 st cmos bi-directional i/o an1 an a/d input lvdin an lvd input reference ra2/an2/v ref -/vrl ra2 st cmos bi-directional i/o an2 an a/d input v ref - an negative analog reference input vrl an internal voltage reference low output ra3/an3/v ref +/vrh ra3 st cmos bi-directional i/o an3 an a/d input v ref + an positive analog reference input vrh an internal voltage reference high output ra4/t0cki ra4 st od bi-directional i/o t0cki st tmr0 clock input ra5/mclr /v pp ra5 st input port mclr st master clear v pp power programming voltage ra6/osc2/clkout ra6 st cmos bi-directional i/o osc2 xtal crystal/resonator clkout cmos f osc /4 output ra7/osc1/clkin ra7 st cmos bi-directional i/o osc1 xtal crystal/resonator clkin st external clock input/er resistor connection rb0/an4/int rb0 ttl cmos bi-directional i/o (1) an4 an a/d input int st interrupt input rb1/an5/ss rb1 ttl cmos bi-directional i/o (1) an5 an a/d input ss st ssp slave select input rb2/sck/scl rb2 ttl cmos bi-directional i/o (1) sck st cmos serial clock i/o for spi scl st od serial clock i/o for i 2 c rb3/ccp1/p1a rb3 ttl cmos bi-directional i/o (1) ccp1 st cmos capture 1 input/compare 1 output p1a cmos pwm p1a output rb4/sdi/sda rb4 ttl cmos bi-directional i/o (1) sdi st serial data in for spi sda st od serial data i/o for i 2 c rb5/sdo/p1b rb5 ttl cmos bi-directional i/o (1) sdo cmos serial data out for spi p1b cmos pwm p1b output note 1: bit programmable pull-ups. 2: only in pic16c770/771 devices.
pic16c717/770/771 ds41120b-page 8 ? 2002 microchip technology inc. rb6/t1oso/t1cki/p1c rb6 ttl cmos bi-directional i/o (1) t1oso xtal crystal/resonator t1cki cmos tmr1 clock input p1c cmos pwm p1c output rb7/t1osi/p1d rb7 ttl cmos bi-directional i/o (1) t1osi xtal tmr1 crystal/resonator p1d cmos pwm p1d output v ss v ss power ground reference for logic and i/o pins v dd v dd power positive supply for logic and i/o pins av ss (2) av ss power ground reference for analog av dd (2) av dd power positive supply for analog table 1-1: pic16c717/770/771 pinout description (continued) name function input type output type description note 1: bit programmable pull-ups. 2: only in pic16c770/771 devices.
? 2002 microchip technology inc. ds41120b-page 9 pic16c717/770/771 2.0 memory organization there are two memory blocks in each of these picmi- cro ? microcontrollers. each block (program memory and data memory) has its own bus, so that concurrent access can occur. additional information on device memory may be found in the picmicro ? mid-range mcu family reference manual, (ds33023). 2.1 program memory organization the pic16c717/770/771 devices have a 13-bit pro- gram counter capable of addressing an 8k x 14 pro- gram memory space. the pic16c717 and the pic16c770 have 2k x 14 words of program memory. the pic16c771 has 4k x 14 words of program mem- ory. accessing a location above the physically imple- mented address will cause a wrap-around. the reset vector is at 0000h and the interrupt vector is at 0004h. figure 2-1: program memory map and stack of the pic16c717 and pic16c770 figure 2-2: program memory map and stack of the pic16c771 2.2 data memory organization the data memory is partitioned into multiple banks, which contain the general purpose registers and the special function registers. bits rp1 and rp0 are the bank select bits. = 00 bank0 = 01 bank1 = 10 bank2 = 11 bank3 each bank extends up to 7fh (128 bytes). the lower locations of each bank are reserved for the special function registers. above the special function regis- ters are general purpose registers, implemented as static ram. all implemented banks contain special function registers. some frequently used special func- tion registers from one bank are mirrored in another bank for code reduction and quicker access. 2.2.1 general purpose register file the register file can be accessed either directly, or indi- rectly, through the file select register fsr. pc<12:0> 13 0000h 0004h 0005h stack level 1 stack level 8 reset vector interrupt vector on-chip call, return retfie, retlw stack level 2 program memory page 0 07ffh 3fffh rp1 rp0 (status<6:5>) pc<12:0> 13 0000h 0004h 0005h stack level 1 stack level 8 reset vector interrupt vector on-chip call, return retfie, retlw stack level 2 program memory page 0 page 1 07ffh 0800h 0fffh 1000h 3fffh
pic16c717/770/771 ds41120b-page 10 ? 2002 microchip technology inc. figure 2-3: register file map indirect addr. (*) tmr0 pcl status fsr porta portb pclath intcon pir1 tmr1l tmr1h t1con tmr2 t2con sspbuf sspcon ccpr1l ccpr1h ccp1con option_reg pcl status fsr trisa trisb pclath intcon pie1 pcon pr2 sspadd sspstat 00h 01h 02h 03h 04h 05h 06h 07h 08h 09h 0ah 0bh 0ch 0dh 0eh 0fh 10h 11h 12h 13h 14h 15h 16h 17h 18h 19h 1ah 1bh 1ch 1dh 1eh 1fh 80h 81h 82h 83h 84h 85h 86h 87h 88h 89h 8ah 8bh 8ch 8dh 8eh 8fh 90h 91h 92h 93h 94h 95h 96h 97h 98h 99h 9ah 9bh 9ch 9dh 9eh 9fh 20h a0h 7fh ffh bank 0 bank 1 unimplemented data memory locations, read as ? 0 ? . * not a physical register. indirect addr. (*) adresl pir2 pie2 adresh adcon0 adcon1 general purpose register general purpose register efh f0h accesses 70h-7fh 96 bytes 80 bytes lvdcon 100h 101h 102h 103h 104h 105h 106h 107h 108h 109h 10ah 10bh 10ch 10dh 10eh 10fh 110h 111h 112h 113h 114h 115h 116h 117h 118h 119h 11ah 11bh 11ch 11dh 11eh 11fh 120h 17fh bank 2 16fh 170h file address pcl status fsr pclath intcon 180h 181h 182h 183h 184h 185h 186h 187h 188h 189h 18ah 18bh 18ch 18dh 18eh 18fh 190h 191h 192h 193h 194h 195h 196h 197h 198h 199h 19ah 19bh 19ch 19dh 19eh 19fh 1a0h 1ffh bank 3 indirect addr. (*) option_reg 1efh 1f0h accesses 70h - 7fh trisb pcl status fsr pclath intcon indirect addr. (*) tmr0 general purpose register accesses 70h - 7fh portb 80 bytes file address file address file address refcon sspcon2 wpub iocb ansel p1del pmdatl pmadrl pmdath pmadrh pmcon1
? 2002 microchip technology inc. ds41120b-page 11 pic16c717/770/771 2.2.2 special function registers the special function registers are registers used by the cpu and peripheral modules for controlling the desired operation of the device. these registers are implemented as static ram. a list of these registers is given in table 2-1. the special function registers can be classified into two sets; core (cpu) and peripheral. those registers asso- ciated with the core functions are described in detail in this section. those related to the operation of the peripheral features are described in detail in that peripheral feature section. table 2-1: pic16c717/770/771 special function register summary address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on: por, bor details on page: bank 0 00h (3) indf addressing this location uses contents of fsr to address data memory (not a physical register) 0000 0000 23 01h tmr0 timer0 module ? s register xxxx xxxx 45 02h (3) pcl program counter's (pc) least significant byte 0000 0000 22 03h (3) status irp rp1 rp0 to pd zdcc 0001 1xxx 14 04h (3) fsr indirect data memory address pointer xxxx xxxx 23 05h porta ra7 ra6 ra5 ra4 ra3 ra2 ra1 ra0 xxxx 0000 25 06h portb rb7 rb6 rb5 rb4 rb3 rb2 rb1 rb0 xxxx xx11 33 07h ? unimplemented ? ? 08h ? unimplemented ? ? 09h ? unimplemented ? ? 0ah (1,3) pclath ? ? ? write buffer for the upper 5 bits of the program counter ---0 0000 22 0bh (3) intcon gie peie t0ie inte rbie t0if intf rbif 0000 000x 16 0ch pir1 ? adif ? ? sspif ccp1if tmr2if tmr1if -0---0000 18 0dh pir2 lvdif ? ? ? bclif ? ? ? 0--- 0--- 20 0eh tmr1l holding register for the least significant byte of the 16-bit tmr1 register xxxx xxxx 47 0fh tmr1h holding register for the most significant byte of the 16-bit tmr1 register xxxx xxxx 47 10h t1con ? ? t1ckps1 t1ckps0 t1oscen t1sync tmr1cs tmr1on --00 0000 47 11h tmr2 timer2 module ? s register 0000 0000 51 12h t2con ? toutps3 toutps2 toutps1 toutps0 tmr2on t2ckps1 t2ckps0 -000 0000 51 13h sspbuf synchronous serial port receive buffer/transmit register xxxx xxxx 70 14h sspcon wcol sspov sspen ckp sspm3 sspm2 sspm1 sspm0 0000 0000 67 15h ccpr1l capture/compare/pwm register1 (lsb) xxxx xxxx 54 16h ccpr1h capture/compare/pwm register1 (msb) xxxx xxxx 54 17h ccp1con pwm1m1 pwm1m0 dc1b1 dc1b0 ccp1m3 ccp1m2 ccp1m1 ccp1m0 0000 0000 53 18h ? unimplemented ? ? 19h ? unimplemented ? ? 1ah ? unimplemented ? ? 1bh ? unimplemented ? ? 1ch ? unimplemented ? ? 1dh ? unimplemented ? ? 1eh adresh a/d high byte result register xxxx xxxx 107 1fh adcon0 adcs1 adcs0 chs2 chs1 chs0 go/done chs3 adon 0000 0000 107 legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented read as ? 0 ? . shaded locations are unimplemented, read as ? 0 ? . note 1: the upper byte of the program counter is not directly accessible. pclath is a holding register for the pc<12:8> whose contents are transferred to the upper byte of the program counter. 2: other (non power-up) resets include external reset through mclr and watchdog timer reset. 3: these registers can be addressed from any bank.
pic16c717/770/771 ds41120b-page 12 ? 2002 microchip technology inc. bank 1 80h (3) indf addressing this location uses contents of fsr to address data memory (not a physical register) 0000 0000 23 81h option_reg rbpu intedg t0cs t0se psa ps2 ps1 ps0 1111 1111 15 82h (3) pcl program counter ? s (pc) least significant byte 0000 0000 22 83h (3) status irp rp1 rp0 to pd zdcc 0001 1xxx 14 84h (3) fsr indirect data memory address pointer xxxx xxxx 23 85h trisa porta data direction register 1111 1111 25 86h trisb portb data direction register 1111 1111 33 87h ? unimplemented ? ? 88h ? unimplemented ? ? 89h ? unimplemented ? ? 8ah (1,3) pclath ? ? ? write buffer for the upper 5 bits of the program counter ---0 0000 22 8bh (3) intcon gie peie t0ie inte rbie t0if intf rbif 0000 000x 16 8ch pie1 ? adie ? ? sspie ccp1ie tmr2ie tmr1ie -0-- 0000 17 8dh pie2 lvdie ? ? ? bclie ? ? ? 0--- 0--- 19 8eh pcon ? ? ? ? oscf ? por bor ---- 1-qq 21 8fh ? unimplemented ? ? 90h ? unimplemented ? ? 91h sspcon2 gcen ackstat ackdt acken rcen pen rsen sen 0000 0000 69 92h pr2 timer2 period register 1111 1111 52 93h sspadd synchronous serial port (i 2 c mode) address register 0000 0000 76 94h sspstat smp cke d/a psr/w ua bf 0000 0000 66 95h wpub portb weak pull-up control 1111 1111 34 96h iocb portb interrupt on change control 1111 0000 34 97h p1del pwm 1 delay value 0000 0000 62 98h ? unimplemented ? ? 99h ? unimplemented ? ? 9ah ? unimplemented ? ? 9bh refcon vrhen vrlen vrhoen vrloen ? ? ? ? 0000 ---- 102 9ch lvdcon ? ? bgst lvden lvv3 lvv2 lvv1 lvv0 --00 0101 101 9dh ansel ? ? analog channel select --11 1111 25 9eh adresl a/d low byte result register xxxx xxxx 107 9fh adcon1 adfm vcfg2 vcfg1 vcfg0 ? ? ? ? 0000 ---- 107 table 2-1: pic16c717/770/771 special function register summary (continued) address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on: por, bor details on page: legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented read as ? 0 ? . shaded locations are unimplemented, read as ? 0 ? . note 1: the upper byte of the program counter is not directly accessible. pclath is a holding register for the pc<12:8> whose contents are transferred to the upper byte of the program counter. 2: other (non power-up) resets include external reset through mclr and watchdog timer reset. 3: these registers can be addressed from any bank.
? 2002 microchip technology inc. ds41120b-page 13 pic16c717/770/771 bank 2 100h (3) indf addressing this location uses contents of fsr to address data memory (not a physical register) 0000 0000 23 101h tmr0 timer0 module ? s register xxxx xxxx 45 102h (3) pcl program counter's (pc) least significant byte 0000 0000 22 103h (3) status irp rp1 rp0 to pd zdcc 0001 1xxx 14 104h (3) fsr indirect data memory address pointer xxxx xxxx 23 105h ? unimplemented ? ? 106h portb portb data latch when written: portb pins when read xxxx xx11 33 107h ? unimplemented ? ? 108h ? unimplemented ? ? 109h ? unimplemented ? ? 10ah (1,3) pclath ? ? ? write buffer for the upper 5 bits of the program counter ---0 0000 22 10bh (3) intcon gie peie t0ie inte rbie t0if intf rbif 0000 000x 16 10ch pmdatl program memory read data low xxxx xxxx 10dh pmadrl program memory read address low xxxx xxxx 10eh pmdath ? ? program memory read data high --xx xxxx 10fh pmadrh ? ? ? ? program memory read address high ---- xxxx 110h- 11fh ? unimplemented ? ? bank 3 180h (3) indf addressing this location uses contents of fsr to address data memory (not a physical register) 0000 0000 23 181h option_reg rbpu intedg t0cs t0se psa ps2 ps1 ps0 1111 1111 15 182h (3) pcl program counter's (pc) least significant byte 0000 0000 22 183h (3) status irp rp1 rp0 to pd zdcc 0001 1xxx 14 184h (3) fsr indirect data memory address pointer xxxx xxxx 23 185h ? unimplemented ? ? 186h trisb portb data direction register 1111 1111 33 187h ? unimplemented ? ? 188h ? unimplemented ? ? 189h ? unimplemented ? ? 18ah (1,3) pclath ? ? ? write buffer for the upper 5 bits of the program counter ---0 0000 22 18bh (3) intcon gie peie t0ie inte rbie t0if intf rbif 0000 000x 16 18ch pmcon1 reserved ? ? ? ? ? ? rd 1--- ---0 18dh- 18fh ? unimplemented ? ? table 2-1: pic16c717/770/771 special function register summary (continued) address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on: por, bor details on page: legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented read as ? 0 ? . shaded locations are unimplemented, read as ? 0 ? . note 1: the upper byte of the program counter is not directly accessible. pclath is a holding register for the pc<12:8> whose contents are transferred to the upper byte of the program counter. 2: other (non power-up) resets include external reset through mclr and watchdog timer reset. 3: these registers can be addressed from any bank.
pic16c717/770/771 ds41120b-page 14 ? 2002 microchip technology inc. 2.2.2.1 status register the status register, shown in register 2-1, contains the arithmetic status of the alu, the reset status and the bank select bits for data memory. the status register can be the destination for any instruction, as with any other register. if the status register is the destination for an instruction that affects the z, dc or c bits, then the write to these three bits is disabled. these bits are set or cleared according to the device logic. furthermore, the to and pd bits are not writable. therefore, the result of an instruction with the status register as destination may be different than intended. for example, clrf status will clear the upper-three bits and set the z bit. this leaves the status register as 000u u1uu (where u = unchanged). it is recommended, therefore, that only bcf, bsf, swapf and movwf instructions are used to alter the status register, because these instructions do not affect the z, c or dc bits from the status register. for other instructions not affecting any status bits, see the "instruction set summary." register 2-1: status register (status: 03h, 83h, 103h, 183h) note: the c and dc bits operate as a borrow and digit borrow bit, respectively, in sub- traction. see the sublw and subwf instructions for examples. r/w-0 r/w-0 r/w-0 r-1 r-1 r/w-x r/w-x r/w-x irp rp1 rp0 to pd zdcc bit 7 bit 0 bit 7 irp: register bank select bit (used for indirect addressing) 1 = bank 2, 3 (100h - 1ffh) 0 = bank 0, 1 (00h - ffh) bit 6-5 rp<1:0>: register bank select bits (used for direct addressing) 11 = bank 3 (180h - 1ffh) 10 = bank 2 (100h - 17fh) 01 = bank 1 (80h - ffh) 00 = bank 0 (00h - 7fh) each bank is 128 bytes bit 4 to : time-out bit 1 = after power-up, clrwdt instruction, or sleep instruction 0 = a wdt time-out occurred bit 3 pd : power-down bit 1 = after power-up or by the clrwdt instruction 0 = by execution of the sleep instruction bit 2 z: zero bit 1 = the result of an arithmetic or logic operation is zero 0 = the result of an arithmetic or logic operation is not zero bit 1 dc: digit carry/borrow bit ( addwf , addlw,sublw,subwf instructions) (for borrow the polarity is reversed) 1 = a carry-out from the 4th low order bit of the result occurred 0 = no carry-out from the 4th low order bit of the result bit 0 c: carry/borrow bit ( addwf , addlw,sublw,subwf instructions) 1 = a carry-out from the most significant bit of the result occurred 0 = no carry-out from the most significant bit of the result occurred note: for borrow, the polarity is reversed. a subtraction is executed by adding the two ? s complement of the second operand. for rotate ( rrf, rlf ) instructions, this bit is loaded with either the high or low order bit of the source register. legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
? 2002 microchip technology inc. ds41120b-page 15 pic16c717/770/771 2.2.2.2 option_reg register the option_reg register is a readable and writable register, which contains various control bits to configure the tmr0 prescaler/wdt postscaler (single assign- able register known also as the prescaler), the external int interrupt, tmr0 and the weak pull-ups on portb. register 2-2: option register (option_reg: 81h, 181h) note: to achieve a 1:1 prescaler assignment for the tmr0 register, assign the prescaler to the watchdog timer. r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 rbpu intedg t0cs t0se psa ps2 ps1 ps0 bit 7 bit 0 bit 7 rbpu : portb pull-up enable bit (1) 1 = portb weak pull-ups are disabled 0 = portb weak pull-ups are enabled by the wpub register bit 6 intedg: interrupt edge select bit 1 = interrupt on rising edge of rb0/int pin 0 = interrupt on falling edge of rb0/int pin bit 5 t0cs: tmr0 clock source select bit 1 = transition on ra4/t0cki pin 0 = internal instruction cycle clock (clkout) bit 4 t0se: tmr0 source edge select bit 1 = increment on high-to-low transition on ra4/t0cki pin 0 = increment on low-to-high transition on ra4/t0cki pin bit 3 psa: prescaler assignment bit 1 = prescaler is assigned to the wdt 0 = prescaler is assigned to the timer0 module bit 2-0 ps<2:0>: prescaler rate select bits note 1: individual weak pull-up on rb pins can be enabled/disabled from the weak pull-up portb register (wpub). legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown 000 001 010 011 100 101 110 111 1 : 2 1 : 4 1 : 8 1 : 16 1 : 32 1 : 64 1 : 128 1 : 256 1 : 1 1 : 2 1 : 4 1 : 8 1 : 16 1 : 32 1 : 64 1 : 128 bit value tmr0 rate wdt rate
pic16c717/770/771 ds41120b-page 16 ? 2002 microchip technology inc. 2.2.2.3 intcon register the intcon register is a readable and writable regis- ter, which contains various enable and flag bits for the tmr0 register overflow, rb port change and external rb0/int pin interrupts. register 2-3: interrupt control register (intcon: 0bh, 8bh, 10bh, 18bh) note: interrupt flag bits get set when an interrupt condition occurs, regardless of the state of its corresponding enable bit or the global enable bit, gie (intcon<7>). user soft- ware should ensure the appropriate inter- rupt flag bits are clear prior to enabling an interrupt. r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-x gie peie t0ie inte rbie t0if intf rbif bit 7 bit 0 bit 7 gie: global interrupt enable bit 1 = enables all un-masked interrupts 0 = disables all interrupts bit 6 peie: peripheral interrupt enable bit 1 = enables all un-masked peripheral interrupts 0 = disables all peripheral interrupts bit 5 t0ie: tmr0 overflow interrupt enable bit 1 = enables the tmr0 interrupt 0 = disables the tmr0 interrupt bit 4 inte: rb0/int external interrupt enable bit 1 = enables the rb0/int external interrupt 0 = disables the rb0/int external interrupt bit 3 rbie: rb port change interrupt enable bit (1) 1 = enables the rb port change interrupt 0 = disables the rb port change interrupt bit 2 t0if: tmr0 overflow interrupt flag bit 1 = tmr0 register has overflowed (must be cleared in software) 0 = tmr0 register did not overflow bit 1 intf: rb0/int external interrupt flag bit 1 = the rb0/int external interrupt occurred (must be cleared in software) 0 = the rb0/int external interrupt did not occur bit 0 rbif: rb port change interrupt flag bit (1) 1 = at least one of the rb<7:0> pins changed state (must be cleared in software) 0 = none of the rb<7:0> pins have changed state note 1: individual rb pin interrupt-on-change can be enabled/disabled from the interrupt-on-change portb register (iocb). legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
? 2002 microchip technology inc. ds41120b-page 17 pic16c717/770/771 2.2.2.4 pie1 register this register contains the individual enable bits for the peripheral interrupts. register 2-4: peripheral interrupt enable register 1 (pie1: 8ch) note: bit peie (intcon<6>) must be set to enable any peripheral interrupt. u-0 r/w-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 ? adie ? ? sspie ccp1ie tmr2ie tmr1ie bit 7 bit 0 bit 7 unimplemented: read as ? 0 ? bit 6 adie: a/d converter interrupt enable bit 1 = enables the a/d interrupt 0 = disables the a/d interrupt bit 5-4 unimplemented: read as ? 0 ? bit 3 sspie: synchronous serial port interrupt enable bit 1 = enables the ssp interrupt 0 = disables the ssp interrupt bit 2 ccp1ie: ccp1 interrupt enable bit 1 = enables the ccp1 interrupt 0 = disables the ccp1 interrupt bit 1 tmr2ie: tmr2 to pr2 match interrupt enable bit 1 = enables the tmr2 to pr2 match interrupt 0 = disables the tmr2 to pr2 match interrupt bit 0 tmr1ie: tmr1 overflow interrupt enable bit 1 = enables the tmr1 overflow interrupt 0 = disables the tmr1 overflow interrupt legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
pic16c717/770/771 ds41120b-page 18 ? 2002 microchip technology inc. 2.2.2.5 pir1 register this register contains the individual flag bits for the peripheral interrupts. register 2-5: peripheral interrupt register 1 (pir1: 0ch) note: interrupt flag bits get set when an interrupt condition occurs, regardless of the state of its corresponding enable bit or the global enable bit, gie (intcon<7>). user soft- ware should ensure the appropriate inter- rupt flag bits are clear prior to enabling an interrupt. u-0 r/w-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 ? adif ? ? sspif ccp1if tmr2if tmr1if bit 7 bit 0 bit 7 unimplemented: read as ? 0 ? . bit 6 adif: a/d converter interrupt flag bit 1 = an a/d conversion completed 0 = the a/d conversion is not complete bit 5-4 unimplemented: read as ? 0 ? bit 3 sspif: synchronous serial port (ssp) interrupt flag 1 = the ssp interrupt condition has occurred, and must be cleared in software before returning from the interrupt service routine. the conditions that will set this bit are: spi a transmission/reception has taken place. i 2 c slave / master a transmission/reception has taken place. i 2 c master the initiated start condition was completed by the ssp module. the initiated stop condition was completed by the ssp module. the initiated restart condition was completed by the ssp module. the initiated acknowledge condition was completed by the ssp module. a start condition occurred while the ssp module was idle (multi-master system). a stop condition occurred while the ssp module was idle (multi-master system). 0 = no ssp interrupt condition has occurred. bit 2 ccp1if: ccp1 interrupt flag bit capture mode 1 = a tmr1 register capture occurred (must be cleared in software) 0 = no tmr1 register capture occurred compare mode 1 = a tmr1 register compare match occurred (must be cleared in software) 0 = no tmr1 register compare match occurred pwm mode unused in this mode bit 1 tmr2if: tmr2 to pr2 match interrupt flag bit 1 = tmr2 to pr2 match occurred (must be cleared in software) 0 = no tmr2 to pr2 match occurred bit 0 tmr1if: tmr1 overflow interrupt flag bit 1 = tmr1 register overflowed (must be cleared in software) 0 = tmr1 register did not overflow legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
? 2002 microchip technology inc. ds41120b-page 19 pic16c717/770/771 2.2.2.6 pie2 register this register contains the individual enable bits for the ssp bus collision and low voltage detect interrupts. register 2-6: peripheral interrupt enable register 2 (pie2: 8dh) r/w-0 u-0 u-0 u-0 r/w-0 u-0 u-0 u-0 lvdie ? ? ? bclie ? ? ? bit 7 bit 0 bit 7 lvdie: low voltage detect interrupt enable bit 1 = lvd interrupt is enabled 0 = lvd interrupt is disabled bit 6-4 unimplemented: read as '0' bit 3 bclie: bus collision interrupt enable bit 1 = bus collision interrupt is enabled 0 = bus collision interrupt is disabled bit 2-0 unimplemented: read as '0' legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
pic16c717/770/771 ds41120b-page 20 ? 2002 microchip technology inc. 2.2.2.7 pir2 register this register contains the ssp bus collision and low- voltage detect interrupt flag bits. . register 2-7: peripheral interrupt register 2 (pir2: 0dh) note: interrupt flag bits get set when an interrupt condition occurs, regardless of the state of its corresponding enable bit or the global enable bit, gie (intcon<7>). user soft- ware should ensure the appropriate inter- rupt flag bits are clear prior to enabling an interrupt. r/w-0 u-0 u-0 u-0 r/w-0 u-0 u-0 u-0 lvdif ? ? ? bclif ? ? ? bit 7 bit 0 bit 7 lvdif: low voltage detect interrupt flag bit 1 = the supply voltage has fallen below the specified lvd voltage (must be cleared in software) 0 = the supply voltage is greater than the specified lvd voltage bit 6-4 unimplemented: read as '0' bit 3 bclif: bus collision interrupt flag bit 1 = a bus collision has occurred while the ssp module configured in i 2 c master was transmitting (must be cleared in software) 0 = no bus collision occurred bit 2-0 unimplemented: read as '0' legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
? 2002 microchip technology inc. ds41120b-page 21 pic16c717/770/771 2.2.2.8 pcon register the power control (pcon) register contains a flag bit to allow differentiation between a power-on reset (por) to an external mclr reset or wdt reset. those devices with brown-out detection circuitry con- tain an additional bit to differentiate a brown-out reset condition from a power-on reset condition. the pcon register also contains the frequency select bit of the intrc or er oscillator. register 2-8: power control register (pcon: 8eh) note: bor is unknown on power-on reset. it must then be set by the user and checked on subsequent resets to see if bor is clear, indicating a brown-out has occurred. the bor status bit is a don ? t care and is not necessarily predictable if the brown-out circuit is disabled (by clearing the boden bit in the configuration word). u-0 u-0 u-0 u-0 r/w-1 u-0 r/w-q r/w-q ? ? ? ? oscf ? por bor bit 7 bit 0 bit 7-4 unimplemented: read as '0' bit 3 oscf: oscillator speed bit intrc mode 1 = 4 mhz nominal 0 = 37 khz nominal er mode 1 = oscillator frequency depends on the external resistor value on the osc1 pin. 0 = 37 khz nominal all other modes x = ignored bit 2 unimplemented: read as '0' bit 1 por : power-on reset status bit 1 = no power-on reset occurred 0 = a power-on reset occurred (must be set in software after a power-on reset occurs) bit 0 bor : brown-out reset status bit (see section 2.2.2.8 note) 1 = no brown-out reset occurred 0 = a brown-out reset occurred (must be set in software after a brown-out reset occurs) legend: q = value depends on conditions r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
pic16c717/770/771 ds41120b-page 22 ? 2002 microchip technology inc. 2.3 pcl and pclath the program counter (pc) specifies the address of the instruction to fetch for execution. the pc is 13 bits wide. the low byte is called the pcl register. this reg- ister is readable and writable. the high byte is called the pch register. this register contains the pc<12:8> bits and is not directly readable or writable. all updates to the pch register occur through the pclath register. 2.3.1 program memory paging pic16c717/770/771 devices are capable of address- ing a continuous 8k word block of program memory. the call and goto instructions provide only 11 bits of address to allow branching within any 2k program memory page. when doing a call or goto instruction, the upper 2 bits of the address are provided by pclath<4:3>. when doing a call or goto instruc- tion, the user must ensure that the page select bits are programmed so that the desired program memory page is addressed. a return instruction pops a pc address off the stack onto the pc register. therefore, manipulation of the pclath<4:3> bits are not required for the return instructions (which pops the address from the stack). 2.4 stack the stack allows a combination of up to 8 program calls and interrupts to occur. the stack contains the return address from this branch in program execution. mid-range devices have an 8-level deep x 13-bit wide hardware stack. the stack space is not part of either program or data space and the stack pointer is not readable or writable. the pc is pushed onto the stack when a call instruction is executed or an interrupt causes a branch. the stack is poped in the event of a return, retlw or a retfie instruction execution. pclath is not modified when the stack is pushed or poped. after the stack has been pushed eight times, the ninth push overwrites the value that was stored from the first push. the tenth push overwrites the second push (and so on). figure 2-4: loading of pc in different situations instruction with pcl as destination 8 alu 12 0 11 opcode <10:0> goto, call pclath<4:3> pclath pclath 87 pclath<4:0> 12 1110 8 7 0 pch pcl pch pcl 5 2
? 2002 microchip technology inc. ds41120b-page 23 pic16c717/770/771 the indf register is not a physical register. address- ing indf actually addresses the register whose address is contained in the fsr register (fsr is a pointer ). this is indirect addressing. reading indf itself indirectly (fsr = 0) will produce 00h. writing to the indf register indirectly results in a no-operation (although status bits may be affected). a simple program to clear ram locations 20h-2fh using indirect addressing is shown in example 2-1. example 2-1: how to clear ram using indirect addressing an effective 9-bit address is obtained by concatenating the 8-bit fsr register and the irp bit (status<7>), as shown in figure 2-5. figure 2-5: direct/indirect addressing movlw 0x20 ;initialize pointer movwf fsr ; to ram next clrf indf ;clear indf register incf fsr ;inc pointer btfss fsr,4 ;all done? goto next ;no, clear next continue : ;yes, continue note 1: for register file map detail see figure 2-3. data memory (1) indirect addressing direct addressing bank select location select rp1:rp0 6 0 from opcode irp fsr register 7 0 bank select location select 00 01 10 11 bank 0 bank 1 bank 2 bank 3 ffh 80h 7fh 00h 17fh 100h 1ffh 180h
pic16c717/770/771 ds41120b-page 24 ? 2002 microchip technology inc. notes:
? 2002 microchip technology inc. ds41120b-page 25 pic16c717/770/771 3.0 i/o ports some pins for these i/o ports are multiplexed with an alternate function for the peripheral features on the device. in general, when a peripheral is enabled, that pin may not be used as a general purpose i/o pin. additional information on i/o ports may be found in the picmicro ? mid-range mcu family reference man- ual, (ds33023). 3.1 i/o port analog/digital mode the pic16c717/770/771 have two i/o ports: porta and portb. some of these port pins are mixed-signal (can be digital or analog). when an analog signal is present on a pin, the pin must be configured as an ana- log input to prevent unnecessary current draw from the power supply. the analog select register (ansel) allows the user to individually select the digital/analog mode on these pins. when the analog mode is active, the port pin will always read 0. register 3-1: analog select register (ansel: 9dh) 3.2 porta and the trisa register porta is a 8-bit wide bi-directional port. the corre- sponding data direction register is trisa. setting a trisa bit (=1) will make the corresponding porta pin an input (i.e., put the corresponding output driver in a hi-impedance mode). clearing a trisa bit (=0) will make the corresponding porta pin an output (i.e., put the contents of the output latch on the selected pin). reading the porta register reads the status of the pins, whereas writing to it will write to the port latch. all write operations are read-modify-write operations. therefore, a write to a port implies that the port pins are read, this value is modified, and then written to the port data latch. pins ra<3:0> are multiplexed with analog functions, such as analog inputs to the a/d converter, analog v ref inputs, and the onboard bandgap reference out- puts. when the analog peripherals are using any of these pins as analog input/output, the ansel register must have the proper value to individually select the analog mode of the corresponding pins. pin ra4 is multiplexed with the timer0 module clock input to become the ra4/t0cki pin. the ra4/t0cki pin is a schmitt trigger input and an open drain output. pin ra5 is multiplexed with the device reset (mclr ) and programming input (v pp ) functions. the ra5/ mclr /v pp input only pin has a schmitt trigger input buffer. all other ra port pins have schmitt trigger input buffers and full cmos output buffers. pins ra6 and ra7 are multiplexed with the oscillator input and output functions. the trisa register controls the direction of the ra pins, even when they are being used as analog inputs. the user must ensure the bits in the trisa register are maintained set when using them as analog inputs. note 1: on a power-on reset, the ansel regis- ter configures these mixed-signal pins as analog mode. 2: if a pin is configured as analog mode, the ra pin will always read '0' and rb pin will always read '1', even if the digital output is active. r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ? ? ans5 ans4 ans3 ans2 ans1 ans0 bit 7 bit 0 bit 7-6 reserved: do not use bit 5-0 ans<5:0>: analog select between analog or digital function on pins an<5:0>, respectively. 0 = digital i/o. pin is assigned to port or special function. 1 = analog input. pin is assigned as analog input. note: setting a pin to an analog input disables the digital input buffer on the pin. the cor- responding tris bit should be set to input mode when using pins as analog inputs. legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown note: upon reset, the ansel register config- ures the ra<3:0> pins as analog inputs. all ra<3:0> pins will read as '0'.
pic16c717/770/771 ds41120b-page 26 ? 2002 microchip technology inc. example 3-1: initializing porta figure 3-1: block diagram of ra0/an0, ra1/an1/lvdin bcf status, rp0 ; select bank 0 clrf porta ; initialize porta by ; clearing output ; data latches bsf status, rp0 ; select bank 1 movlw 0fh ; value used to ; initialize data ; direction movwf trisa ; set ra<3:0> as inputs ; ra<7:4> as outputs. ra<7:6>availability depends on oscillator selection. movlw 03 ; set ra<1:0> as analog inputs, ra<7:2> are digital i/o movwf ansel bcf status, rp0 ; return to bank 0 data bus q d q ck q d q ck qd en p n wr port wr tris data latch tris mode v ss v dd schmitt trigger to a/d converter input or lvd module input rd tris q d q ck analog select wr ansel rd port v dd v ss
? 2002 microchip technology inc. ds41120b-page 27 pic16c717/770/771 figure 3-2: block diagram of ra2/an2/v ref -/vrl and ra3/an3/v ref +/vrh to a/d converter input vrh, vrl outputs (from v ref -lvd-bor module) and v ref +, v ref - inputs sense input for vrh, vrl amplifier vrh, vrl output enable data bus q d q ck q d q ck p n wr port wr tris data latch tris mode v ss v dd schmitt trigger rd tris q d q ck analog select wr ansel rd port v dd v ss qd en
pic16c717/770/771 ds41120b-page 28 ? 2002 microchip technology inc. figure 3-3: block diagram of ra4/t0cki data bus q d q ck q d q ck qd en n wr port wr tris data latch rd v ss schmitt trigger input buffer tmr0 clock input rd tris tris latch port v ss
? 2002 microchip technology inc. ds41120b-page 29 pic16c717/770/771 figure 3-4: block diagram of ra5/mclr /v pp data bus qd en rd port schmitt trigger rd tris v ss to m c l r circuit mclr filter v ss hv detect program mode
pic16c717/770/771 ds41120b-page 30 ? 2002 microchip technology inc. figure 3-5: block diagram of ra6/osc2/clkout pin data bus q d q ck p n wr porta wr trisa data latch tris latch rd trisa rd porta v ss v dd q d q ck schmitt trigger input buffer oscillator circuit from osc1 1 0 clkout (fosc/4) (intrc or er) and clkout v dd v ss d q en ec or [(er or intrc) and c lkout ]
? 2002 microchip technology inc. ds41120b-page 31 pic16c717/770/771 figure 3-6: block diagram of ra7/osc1/clkin pin data bus q d q ck p n wr porta wr trisa data latch tris latch rd trisa rd porta vss v dd q d q ck schmitt trigger input buffer oscillator circuit to osc2 intrc intrc schmitt trigger input buffer to chip clock drivers ec mode v dd d q en
pic16c717/770/771 ds41120b-page 32 ? 2002 microchip technology inc. table 3-1: porta functions table 3-2: summary of registers associated with porta name function input type output type description ra0/an0 ra0 st cmos bi-directional i/o an0 an a/d input ra1/an1/lvdin ra1 st cmos bi-directional i/o an1 an a/d input lvdin an lvd input reference ra2/an2/v ref -/vrl ra2 st cmos bi-directional i/o an2 an a/d input v ref - an negative analog reference input vrl an internal voltage reference low output ra3/an3/v ref +/vrh ra3 st cmos bi-directional i/o an3 an a/d input v ref + an positive analog reference input vrh an internal voltage reference high output ra4/t0cki ra4 st od bi-directional i/o t0cki st tmr0 clock input ra5/mclr /v pp ra5 st input port mclr st master clear v pp power programming voltage ra6/osc2/clkout ra6 st cmos bi-directional i/o osc2 xtal crystal/resonator clkout cmos f osc /4 output ra7/osc1/clkin ra7 st cmos bi-directional i/o osc1 xtal crystal/resonator clkin st/an external clock input/er resistor connection address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on: por, bor value on all other resets 05h porta ra7 ra6 ra5 ra4 ra3 ra2 ra1 ra0 xxxx 0000 uuuu 0000 85h trisa porta data direction register 1111 1111 1111 1111 9dh ansel ? ? ans5 ans4 ans3 ans2 ans1 ans0 --11 1111 --11 1111 legend: x = unknown, u = unchanged, - = unimplemented locations read as ? 0 ? . shaded cells are not used by porta.
? 2002 microchip technology inc. ds41120b-page 33 pic16c717/770/771 3.3 portb and the trisb register portb is an 8-bit wide bi-directional port. the corre- sponding data direction register is trisb. setting a trisb bit (=1) will make the corresponding portb pin an input (i.e., put the corresponding output driver in a hi-impedance mode). clearing a trisb bit (=0) will make the corresponding portb pin an output (i.e., put the contents of the output latch on the selected pin). example 3-2: initializing portb each of the portb pins has an internal pull-up, which can be individually enabled from the wpub register. a single global enable bit can turn on/off the enabled pull- ups. clearing the rbpu bit, (option_reg<7>), enables the weak pull-up resistors. the weak pull-up is automatically turned off when the port pin is configured as an output. the pull-ups are disabled on a power-on reset. each of the portb pins, if configured as input, also has an interrupt-on-change feature, which can be indi- vidually selected from the iocb register. the rbie bit in the intcon register functions as a global enable bit to turn on/off the interrupt-on-change feature. the selected inputs are compared to the old value latched on the last read of portb. the "mismatch" outputs are or ? ed together to generate the rb port change inter- rupt with flag bit rbif (intcon<0>). this interrupt can wake the device from sleep. the user, in the interrupt service routine, can clear the inter- rupt in the following manner: a) any read or write of portb. this will end the mismatch condition. a) clear flag bit rbif. a mismatch condition will continue to set flag bit rbif. reading portb will end the mismatch condition and allow flag bit rbif to be cleared. the interrupt-on-change feature is recommended for wake-up on key depression operation and operations where portb is only used for the interrupt-on-change feature. polling of portb is not recommended while using the interrupt-on-change feature. bcf status, rp0 ; clrf portb ; initialize portb by ; clearing output ; data latches bsf status, rp0 ; select bank 1 movlw 0xcf ; value used to ; initialize data ; direction movwf trisb ; set rb<3:0> as inputs ; rb<5:4> as outputs ; rb<7:6> as inputs movlw 0x30 ; set rb<1:0> as analog inputs movwf ansel ; bcf status, rp0 ; return to bank 0
pic16c717/770/771 ds41120b-page 34 ? 2002 microchip technology inc. register 3-2: weak pull-up portb register (wpub: 95h) register 3-3: interrupt-on-change portb register (iocb: 96h) r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 wpub7 wpub6 wpub5 wpub4 wpub3 wpub2 wpub1 wpub0 bit 7 bit 0 bit 7-0 wpub<7:0>: portb weak pull-up control bits 1 = weak pull-up enabled 0 = weak pull-up disabled note 1: for the wpub register setting to take effect, the rbpu bit in the option_reg register must be cleared. 2: the weak pull-up device is automatically disabled if the pin is in output mode (tris = 0). legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown r/w-1 r/w-1 r/w-1 r/w-1 r/w-0 r/w-0 r/w-0 r/w-0 iocb7 iocb6 iocb5 iocb4 iocb3 iocb2 iocb1 iocb0 bit 7 bit 0 bit 7-0 iocb<7:0>: interrupt-on-change portb control bits 1 = interrupt-on-change enabled 0 = interrupt-on-change disabled note: the interrupt enable bits gie and rbie in the intcon register must be set for indi- vidual interrupts to be recognized. legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
? 2002 microchip technology inc. ds41120b-page 35 pic16c717/770/771 the rb0 pin is multiplexed with the a/d converter ana- log input 4 and the external interrupt input (rb0/an4/ int). when the pin is used as analog input, the ansel register must have the proper value to select the rb0 pin as analog mode. the rb1 pin is multiplexed with the a/d converter ana- log input 5 and the mssp module slave select input (rb1/an5/ss ). when the pin is used as analog input, the ansel register must have the proper value to select the rb1 pin as analog mode. figure 3-7: block diagram of rb0/an4/int, rb1/an5/ss pin note: upon reset, the ansel register config- ures the rb1 and rb0 pins as analog inputs. both rb1 and rb0 pins will read as ? 1 ? . data bus wr wr rd portb reg tris reg to int input or mssp module q d ck q d ck en qd en rd rbpu weak pull-up ttl schmitt trigger p n v ss v dd q d ck q d ck wpub reg iocb reg port tris port tris wr wpub q d q en d q en q3 q1 ... set rbif from rb<7:0> pins q q d q ck analog select wr ansel wr iocb v dd v ss q p v dd q to a/d converter
pic16c717/770/771 ds41120b-page 36 ? 2002 microchip technology inc. figure 3-8: block diagram of rb2/sck/scl, rb3/ccp1/p1a, rb4/sdi/sda, rb5/sdo/p1b data bus wr wr rd portb reg tris reg sck, scl, cc, sdi, sda inputs q d ck q d ck en qd en rd rbpu weak pull-up schmitt trigger p n v ss v dd q d ck q d ck wpub reg iocb reg port tris port tris wr wpub q d q en d q en q3 q1 ... set rbif from rb<7:0> pins q wr iocb v dd v ss q p v dd q 1 0 spec. func en. sda, sdo, sck, ccp1, p1a, p1b ttl
? 2002 microchip technology inc. ds41120b-page 37 pic16c717/770/771 figure 3-9: block diagram of rb6/t1oso/t1cki/p1c data latch tris latch rd trisb p v ss q d q ck q d q ck n v dd rd portb wr portb wr trisb t1oscen tmr1 clock rbpu v dd weak pull-up p from rb7 from qd en set rbif rb<7:0> pins rd port q3 q1 serial programming clock ttl input buffer tmr1 oscillator qd en v dd data bus q d ck wpub reg wr wpub q iocb reg wr iocb q d ck q note: the tmr1 oscillator enable (t1oscen = 1) overrides the rb6 i/o port and p1c functions. ... schmitt trigger cmos
pic16c717/770/771 ds41120b-page 38 ? 2002 microchip technology inc. figure 3-10: block diagram of the rb7/t1osi/p1d data latch tris latch rd trisb p v ss q d q ck q d q ck n v dd rd portb wr portb wr trisb t10scen t1oscen to r b 6 rbpu v dd weak pull-up p ttl input buffer from qd en qd en set rbif rb<7:0> pins rd port q3 q1 serial programming input schmitt trigger tmr1 oscillator v dd data bus q d ck wpub reg wr wpub q q d ck iocb reg wr iocb q note: the tmr1 oscillator enable (t1oscen = 1) overrides the rb7 i/o port and p1d functions. ...
? 2002 microchip technology inc. ds41120b-page 39 pic16c717/770/771 table 3-3: portb functions table 3-4: summary of registers associated with portb name function input type output type description rb0/an4/int rb0 ttl cmos bi-directional i/o (1) an4 an a/d input int st interrupt input rb1/an5/ss rb1 ttl cmos bi-directional i/o (1) an5 an a/d input ss st ssp slave select input rb2/sck/scl rb2 ttl cmos bi-directional i/o (1) sck st cmos serial clock i/o for spi scl st od serial clock i/o for i 2 c rb3/ccp1/p1a rb3 ttl cmos bi-directional i/o (1) ccp1 st cmos capture 1 input/compare 1 output p1a cmos pwm p1a output rb4/sdi/sda rb4 ttl cmos bi-directional i/o (1) sdi st serial data in for spi sda st od serial data i/o for i 2 c rb5/sdo/p1b rb5 ttl cmos bi-directional i/o (1) sdo cmos serial data out for spi p1b cmos pwm p1b output rb6/t1oso/t1cki/p1c rb6 ttl cmos bi-directional i/o (1) t1oso xtal crystal/resonator t1cki cmos tmr1 clock input p1c cmos pwm p1c output rb7/t1osi/p1d rb7 ttl cmos bi-directional i/o (1) t1osi xtal tmr1 crystal/resonator p1d cmos pwm p1d output note 1: bit programmable pull-ups. address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on: por, bor value on all other resets 06h, 106h portb rb7 rb6 rb5 rb4 rb3 rb2 rb1 rb0 xxxx xx11 uuuu uu11 86h, 186h trisb portb data direction register 1111 1111 1111 1111 81h, 181h option_reg rbpu intedg t0cs t0se psa ps2 ps1 ps0 1111 1111 1111 1111 95h wpub portb weak pull-up control 1111 1111 1111 1111 96h iocb portb interrupt on change control 1111 0000 1111 0000 9dh ansel ? ? ans5 ans4 ans3 ans2 ans1 ans0 --11 1111 --11 1111 legend: x = unknown, u = unchanged. shaded cells are not used by portb.
pic16c717/770/771 ds41120b-page 40 ? 2002 microchip technology inc. notes:
? 2002 microchip technology inc. ds41120b-page 41 pic16c717/770/771 4.0 program memory read (pmr) program memory is readable during normal operation (full v dd range). it is indirectly addressed through the special function registers:  pmcon1  pmdath  pmdatl  pmadrh  pmadrl when interfacing the program memory block, the pmdath & pmdatl registers form a 2-byte word, which holds the 14-bit data. the pmadrh & pmadrl registers form a 2-byte word, which holds the 12-bit address of the program memory location being accessed. mid-range devices have up to 8k words of program eprom with an address range from 0h to 3fffh. when the device contains less memory than the full address range of the pmadrh:pmardl regis- ters, the most significant bits of the pmadrh register are ignored. 4.1 pmcon1 register pmcon1 is the control register for program memory accesses. control bit rd initiates a read operation. this bit cannot be cleared, only set, in software. it is cleared in hard- ware at completion of the read operation. register 4-1: program memory read control register 1 (pmcon1: 18ch) 4.2 pmdath and pmdatl registers the pmdath:pmdatl registers are loaded with the contents of program memory addressed by the pmadrh and pmadrl registers upon completion of a program memory read command. r-1 u-0 u-0 u-0 u-0 u-0 u-0 r/s-0 reserved ? ? ? ? ? ? rd bit 7 bit 0 bit 7 reserved: read as ? 1 ? bit 6-1 unimplemented: read as '0' bit 0 rd : read control bit 1 = initiates a program memory read (read takes 2 cycles). rd is cleared in hardware. 0 = reserved legend: s = settable (cleared in hardware) r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
pic16c717/770/771 ds41120b-page 42 ? 2002 microchip technology inc. register 4-2: program memory data high (pmdath: 10eh) register 4-3: program memory data low (pmdatl: 10ch) register 4-4: program memory address high (pmadrh: 10fh) register 4-5: program memory address low (pmadrl: 10dh) u-0 u-0 r-x r-x r-x r-x r-x r-x ? ? pmd13 pmd12 pmd11 pmd10 pmd9 pmd8 bit 7 bit 0 bit 7-6 unimplemented: read as '0' bit 5-0 pmd<13:8>: the value of the program memory word pointed to by pmadrh and pmadrl after a program memory read command. legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown r-x r-x r-x r-x r-x r-x r-x r-x pmd7 pmd6 pmd5 pmd4 pmd3 pmd2 pmd1 pmd0 bit 7 bit 0 bit 7-0 pmd<7:0>: the value of the program memory word pointed to by pmadrh and pmadrl after a program memory read command. legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown u-0 u-0 u-0 u-0 r/w-x r/w-x r/w-x r/w-x ? ? ? ? pma11 pma10 pma9 pma8 bit 7 bit 0 bit 7-4 unimplemented: read as '0' bit 3-0 pma<11:8>: pmr address bits legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x pma7 pma6 pma5 pma4 pma3 pma2 pma1 pma0 bit 7 bit 0 bit 7-0 pma<7:0>: pmr address bits legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
? 2002 microchip technology inc. ds41120b-page 43 pic16c717/770/771 4.3 reading the eprom program memory to read a program memory location, the user must write 2 bytes of the address to the pmadrh and pmadrl registers, then set control bit rd (pmcon1<0>). once the read control bit is set, the program memory read (pmr) controller will use the second instruction cycle after to read the data. this causes the second instruction immediately following the ? bsf pmcon1,rd ? instruction to be ignored. the data is available, in the very next cycle, in the pmdath and pmdatl registers; therefore it can be read as 2 bytes in the following instructions. pmdath and pmdatl registers will hold this value until another program memory read or until it is written to by the user. example 4-1: otp program memory read 4.4 operation during code protect when the device is code protected, the cpu can still perform the program memory read function. figure 4-1: program memory read cycle execution note: the two instructions that follow setting the pmcon1 read bit must be nop s. bsf status, rp1 ; bcf status, rp0 ; bank 2 movlw ms_prog_pm_addr ; movwf pmadrh ; ms byte of program memory address to read movlw ls_prog_pm_addr ; movwf pmadrl ; ls byte of program memory address to read bsf status, rp0 ; bank 3 bsf pmcon1, rd ; program memory read nop ; this instruction must be an nop nop ; this instruction must be an nop next instruction ; pmdath:pmdatl now has the data q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 bsf pmcon1,rd executed here instr(pc+1) executed here forced nop executed here pc pc+1 pmadrh,pmadrl pc+3 pc+5 program rd bit pc+3 pc+4 instr(pc-1) executed here instr(pc+3) executed here instr(pc+4) executed here pmdath pmdatl register memory addr
pic16c717/770/771 ds41120b-page 44 ? 2002 microchip technology inc. table 4-1: program memory read register summary address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on: por, bor value on all other resets 18ch pmcon1 reserved ? ? ? ? ? ? rd 1--- ---0 1--- ---0 10eh pmdath ? ? pmd13 pmd12 pmd11 pmd10 pmd9 pmd8 --xx xxxx --uu uuuu 10ch pmdatl pmd7 pmd6 pmd5 pmd4 pmd3 pmd2 pmd1 pmd0 xxxx xxxx uuuu uuuu 10fh pmadrh ? ? ? ? pma11 pma10 pma9 pma8 ---- xxxx ---- uuuu 10dh pmadrl pma7 pma6 pma5 pma4 pma3 pma2 pma1 pma0 xxxx xxxx uuuu uuuu legend: x = unknown, u = unchanged, - = unimplemented locations read as '0'. shaded cells are not used by program memory read.
? 2002 microchip technology inc. ds41120b-page 45 pic16c717/770/771 5.0 timer0 module the timer0 module timer/counter has the following fea- tures:  8-bit timer/counter  readable and writable  internal or external clock select  edge select for external clock  8-bit software programmable prescaler  interrupt on overflow from ffh to 00h figure 5-1 is a simplified block diagram of the timer0 module. additional information on timer modules is available in the picmicro ? mid-range mcu family reference manual, (ds33023). 5.1 timer0 operation timer0 can operate as a timer or as a counter. timer mode is selected by clearing bit t0cs (option_reg<5>). in timer mode, the timer0 mod- ule will increment every instruction cycle (without pres- caler). if the tmr0 register is written, the increment is inhibited for the following two instruction cycles. the user can work around this by writing an adjusted value to the tmr0 register. counter mode is selected by setting bit t0cs (option_reg<5>). in counter mode, timer0 will increment either on every rising or falling edge of pin ra4/t0cki. the incrementing edge is determined by the timer0 source edge select bit t0se (option_reg<4>). clearing bit t0se selects the ris- ing edge. restrictions on the external clock input are discussed in below. when an external clock input is used for timer0, it must meet certain requirements. the requirements ensure the external clock can be synchronized with the internal phase clock (t osc ). also, there is a delay in the actual incrementing of timer0 after synchronization. additional information on external clock requirements is available in the picmicro ? mid-range mcu family reference manual, (ds33023). 5.2 prescaler an 8-bit counter is available as a prescaler for the timer0 module, or as a postscaler for the watchdog timer, respectively (figure 5-2). for simplicity, this counter is being referred to as ? prescaler ? throughout this data sheet. note that there is only one prescaler available which is mutually exclusively shared between the timer0 module and the watchdog timer. thus, a prescaler assignment for the timer0 module means that there is no prescaler for the watchdog timer, and vice-versa. the prescaler is not readable or writable. the psa and ps<2:0> bits (option_reg<3:0>) determine the prescaler assignment and prescale ratio. clearing bit psa will assign the prescaler to the timer0 module. when the prescaler is assigned to the timer0 module, prescale values of 1:2, 1:4, ..., 1:256 are selectable. setting bit psa will assign the prescaler to the watch- dog timer (wdt). when the prescaler is assigned to the wdt, prescale values of 1:1, 1:2, ..., 1:128 are selectable. when assigned to the timer0 module, all instructions writing to the tmr0 register (e.g. clrf 1, movwf 1, bsf 1, x....etc .) will clear the prescaler. when assigned to wdt, a clrwdt instruction will clear the prescaler along with the wdt. figure 5-1: timer0 block diagram note: writing to tmr0 when the prescaler is assigned to timer0 will clear the prescaler count, but will not change the prescaler assignment. note 1: t0cs, t0se, psa, ps<2:0> (option_reg<5:0>). 2: the prescaler is shared with watchdog timer (refer to figure 5-2 for detailed block diagram). ra4/t0cki t0se 0 1 1 0 pin t0cs fosc/4 programmable prescaler sync with internal clocks tmr0 psout (2 tcy delay) psout data bus 8 psa ps2, ps1, ps0 set interrupt flag bit t0if on overflow 3
pic16c717/770/771 ds41120b-page 46 ? 2002 microchip technology inc. 5.2.1 switching prescaler assignment the prescaler assignment is fully under software con- trol (i.e., it can be changed ? on-the-fly ? during program execution). 5.3 timer0 interrupt the tmr0 interrupt is generated when the tmr0 reg- ister overflows from ffh to 00h. this overflow sets bit t0if (intcon<2>). the interrupt can be masked by clearing bit t0ie (intcon<5>). bit t0if must be cleared in software by the timer0 module interrupt ser- vice routine before re-enabling this interrupt. the tmr0 interrupt cannot awaken the processor from sleep since the timer is shut off during sleep. figure 5-2: block diagram of the timer0/wdt prescaler table 5-1: registers associated with timer0 note: to avoid an unintended device reset, a specific instruction sequence (shown in the picmicro ? mid-range reference man- ual, ds33023) must be executed when changing the prescaler assignment from timer0 to the wdt. this sequence must be followed even if the wdt is disabled. address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on: por, bor value on all other resets 01h,101h tmr0 timer0 register xxxx xxxx uuuu uuuu 0bh,8bh, 10bh,18bh intcon gie peie t0ie inte rbie t0if intf rbif 0000 000x 0000 000u 81h,181h option_reg rbpu intedg t0cs t0se psa ps2 ps1 ps0 1111 1111 1111 1111 85h trisa porta data direction register 1111 1111 1111 1111 legend: x = unknown, u = unchanged, - = unimplemented locations read as ? 0 ? . shaded cells are not used by timer0. ra4/t0cki t0se pin m u x clkout (= fosc/4) sync 2 cycles tmr0 reg 8-bit prescaler 8 - to - 1mux m u x m u x watchdog timer psa 0 1 0 1 wdt time-out ps<2:0> 8 note: t0cs, t0se, psa, ps<2:0> are (option_reg<5:0>). psa wdt enable bit m u x 0 1 0 1 data bus set flag bit t0if on overflow 8 psa t0cs
? 2002 microchip technology inc. ds41120b-page 47 pic16c717/770/771 6.0 timer1 module the timer1 module timer/counter has the following fea- tures:  16-bit timer/counter (two 8-bit registers; tmr1h and tmr1l)  readable and writable (both registers)  internal or external clock select  interrupt on overflow from ffffh to 0000h  reset from eccp module trigger timer1 has a control register, shown in register 6-1. timer1 can be enabled/disabled by setting/clearing control bit tmr1on (t1con<0>). figure 6-2 is a simplified block diagram of the timer1 module. additional information on timer modules is available in the picmicro ? mid-range mcu family reference manual, (ds33023). 6.1 timer1 operation timer1 can operate in one of these modes:  as a timer  as a synchronous counter  as an asynchronous counter the operating mode is determined by the clock select bit, tmr1cs (t1con<1>). in timer mode, timer1 increments every instruction cycle. in counter mode, it increments on every rising edge of the external clock input. register 6-1: timer1 control register (t1con: 10h) u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? t1ckps1 t1ckps0 t1oscen t1sync tmr1cs tmr1on bit 7 bit 0 bit 7-6 unimplemented: read as '0' bit 5-4 t1ckps<1:0>: timer1 input clock prescale select bits 11 = 1:8 prescale value 10 = 1:4 prescale value 01 = 1:2 prescale value 00 = 1:1 prescale value bit 3 t1oscen: timer1 oscillator enable control bit 1 = oscillator is enabled 0 = oscillator is shut of f (1) bit 2 t1sync : timer1 external clock input synchronization control bit tmr1cs = 1: 1 = do not synchronize external clock input 0 = synchronize external clock input tmr1cs = 0: this bit is ignored. timer1 uses the internal clock when tmr1cs = 0. bit 1 tmr1cs: timer1 clock source select bit 1 = external clock from pin rb6/t1oso/t1cki /p1c (on the rising edge) 0 = internal clock (f osc /4) bit 0 tmr1on: timer1 on bit 1 = enables timer1 0 = stops timer1 note 1: the oscillator inverter and feedback resistor are turned off to eliminate power drain. legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
pic16c717/770/771 ds41120b-page 48 ? 2002 microchip technology inc. 6.1.1 timer1 counter operation in this mode, timer1 is being incremented via an exter- nal source. increments occur on a rising edge. after timer1 is enabled in counter mode, the module must first have a falling edge before the counter begins to increment. figure 6-1: timer1 incrementing edge figure 6-2: timer1 block diagram t1cki (initially high) t1cki (initially low) note: arrows indicate counter increments. first falling edge of the t1on enabled first falling edge of the t1on enabled tmr1h tmr1l t1osc t1sync tmr1cs t1ckps<1:0> sleep input t1oscen enable oscillator (1) fosc/4 internal clock tmr1on on/off prescaler 1, 2, 4, 8 synchronize det 1 0 0 1 synchronized clock input 2 rb6/t1oso/t1cki/p1c rb7/t1osi/p1d note 1: when the t1oscen bit is cleared, the inverter and feedback resistor are turned off. this eliminates power drain. set flag bit tmr1if on overflow tmr1
? 2002 microchip technology inc. ds41120b-page 49 pic16c717/770/771 6.2 timer1 oscillator a crystal oscillator circuit is built in between pins t1osi (input) and t1oso (amplifier output). it is enabled by setting control bit t1oscen (t1con<3>). the oscilla- tor is a low power oscillator rated up to 200 khz. it will continue to run during sleep. it is primarily intended for a 32 khz crystal. table 6-1 shows the capacitor selection for the timer1 oscillator. the timer1 oscillator is identical to the lp oscillator. the user must provide a software time delay to ensure proper oscillator start-up. table 6-1: capacitor selection for the timer1 oscillator 6.3 timer1 interrupt the tmr1 register pair (tmr1h:tmr1l) increments from 0000h to ffffh and rolls over to 0000h. the tmr1 interrupt, if enabled, is generated on overflow which is latched in interrupt flag bit tmr1if (pir1<0>). this interrupt can be enabled/disabled by setting/clear- ing tmr1 interrupt enable bit tmr1ie (pie1<0>). 6.4 resetting timer1 using a ccp trigger output if the eccp module is configured in compare mode to generate a ? special event trigger" (ccp1m<3:0> = 1011 ), this signal will reset timer1 and start an a/d conversion (if the a/d module is enabled). timer1 must be configured for either timer or synchro- nized counter mode to take advantage of this feature. if timer1 is running in asynchronous counter mode, this reset operation may not work. in the event that a write to timer1 coincides with a spe- cial event trigger from eccp, the write will take prece- dence. in this mode of operation, the ccpr1h:ccpr1l regis- ters pair effectively becomes the period register for timer1. table 6-2: registers associated with timer1 as a timer/counter osc type freq c1 c2 lp 32 khz 33 pf 33 pf 100 khz 15 pf 15 pf 200 khz 15 pf 15 pf these values are for design guidance only. note 1: higher capacitance increases the stability of oscillator but also increases the start-up time. 2: since each resonator/crystal has its own characteristics, the user should consult the resonator/crystal manufacturer for appro- priate values of external components. note: the special event triggers from the ccp1 module will not set interrupt flag bit tmr1if (pir1<0>). address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on: por, bor value on all other resets 0bh,8bh, 10bh,18bh intcon gie peie t0ie inte rbie t0if intf rbif 0000 000x 0000 000u 0ch pir1 ? adif ? ? sspif ccp1if tmr2if tmr1if -0-- 0000 -0-- 0000 8ch pie1 ? adie ? ? sspie ccp1ie tmr2ie tmr1ie -0-- 0000 -0-- 0000 0eh tmr1l holding register for the least significant byte of the 16-bit tmr1 register xxxx xxxx uuuu uuuu 0fh tmr1h holding register for the most significant byte of the 16-bit tmr1 register xxxx xxxx uuuu uuuu 10h t1con ? ? t1ckps1 t1ckps0 t1oscen t1sync tmr1cs tmr1on --00 0000 --uu uuuu legend: x = unknown, u = unchanged, - = unimplemented read as ? 0 ? . shaded cells are not used by the timer1 module.
pic16c717/770/771 ds41120b-page 50 ? 2002 microchip technology inc. notes:
? 2002 microchip technology inc. ds41120b-page 51 pic16c717/770/771 7.0 timer2 module the timer2 module timer has the following features:  8-bit timer (tmr2 register)  8-bit period register (pr2)  readable and writable (both registers)  software programmable prescaler (1:1, 1:4, 1:16)  software programmable postscaler (1:1 to 1:16)  interrupt on tmr2 match of pr2  ssp module optional use of tmr2 output to gen- erate clock shift timer2 has a control register, shown in register 7-1. timer2 can be shut off by clearing control bit tmr2on (t2con<2>) to minimize power consumption. figure 7-1 is a simplified block diagram of the timer2 module. additional information on timer modules is available in the picmicro ? mid-range mcu family reference manual, (ds33023). 7.1 timer2 operation timer2 can be used as the pwm time-base for pwm mode of the eccp module. the tmr2 register is readable and writable, and is cleared on any device reset. the input clock (f osc /4) has a prescale option of 1:1, 1:4 or 1:16, selected by control bits t2ckps<1:0> (t2con<1:0>). the match output of tmr2 goes through a 4-bit postscaler (which gives a 1:1 to 1:16 scaling inclusive) to generate a tmr2 interrupt (latched in flag bit tmr2if, (pir1<1>)). the prescaler and postscaler counters are cleared when any of the following occurs:  a write to the tmr2 register  a write to the t2con register  any device reset (power-on reset, mclr reset, watchdog timer reset, or brown-out reset) tmr2 is not cleared when t2con is written. register 7-1: timer2 control register (t2con1: 12h) u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? toutps3 toutps2 toutps1 toutps0 tmr2on t2ckps1 t2ckps0 bit 7 bit 0 bit 7 unimplemented: read as '0' bit 6-3 toutps<3:0>: timer2 output postscale select bits 0000 = 1:1 postscale 0001 = 1:2 postscale    1111 = 1:16 postscale bit 2 tmr2on: timer2 on bit 1 = timer2 is on 0 = timer2 is off bit 1-0 t2ckps<1:0>: timer2 clock prescale select bits 00 = prescaler is 1 01 = prescaler is 4 1x = prescaler is 16 legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
pic16c717/770/771 ds41120b-page 52 ? 2002 microchip technology inc. 7.2 timer2 interrupt the timer2 module has an 8-bit period register pr2. timer2 increments from 00h until it matches pr2 and then resets to 00h on the next increment cycle. pr2 is a readable and writable register. the pr2 register is initialized to ffh upon reset. 7.3 output of tmr2 the output of tmr2 (before the postscaler) is fed to the synchronous serial port module which optionally uses it to generate shift clock. figure 7-1: timer2 block diagram table 7-1: registers associated with timer2 as a timer/counter comparator tmr2 sets flag tmr2 reg output (1) reset postscaler prescaler pr2 reg 2 fosc/4 1:1 1:16 1:1, 1:4, 1:16 eq 4 bit tmr2if note: tmr2 register output can be software selected by the ssp module as a baud clock. to address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on: por, bor value on all other resets 0bh,8bh, 10bh,18bh intcon gie peie t0ie inte rbie t0if intf rbif 0000 000x 0000 000u 0ch pir1 ? adif ? ? sspif ccp1if tmr2if tmr1if -0-- 0000 -0-- 0000 8ch pie1 ? adie ? ? sspie ccp1ie tmr2ie tmr1ie -0-- 0000 -0-- 0000 11h tmr2 timer2 register 0000 0000 0000 0000 12h t2con ? toutps3 toutps2 toutps1 toutps0 tmr2on t2ckps1 t2ckps0 -000 0000 -000 0000 92h pr2 timer2 period register 1111 1111 1111 1111 legend: x = unknown, u = unchanged, - = unimplemented read as ? 0 ? . shaded cells are not used by the timer2 module.
? 2002 microchip technology inc. ds41120b-page 53 pic16c717/770/771 8.0 enhanced capture/ compare/pwm (eccp) modules the eccp (enhanced capture/compare/pwm) module contains a 16-bit register which can operate as a 16-bit capture register, as a 16-bit compare register or as a pwm master/slave duty cycle register. table 8-1 shows the timer resources of the eccp mod- ule modes. capture/compare/pwm register1 (ccpr1) is com- prised of two 8-bit registers: ccpr1l (low byte) and ccpr1h (high byte). the ccp1con and p1del reg- isters control the operation of eccp. all are readable and writable. register 8-1: ccp1 control register (ccp1con: 17h) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 pwm1m1 pwm1m0 dc1b1 dc1b0 ccp1m3 ccp1m2 ccp1m1 ccp1m0 bit 7 bit 0 bit 7-6 pwm1m<1:0>: pwm output configuration ccp1m<3:2> = 00, 01, 10 xx = p1a assigned as capture input, compare output. p1b, p1c, p1d assigned as port pins. ccp1m<3:2> = 11 00 = single output. p1a modulated. p1b, p1c, p1d assigned as port pins. 01 = full-bridge output forward. p1d modulated. p1a active. p1b, p1c inactive. 10 = half-bridge output. p1a, p1b modulated with deadband control. p1c, p1d assigned as port pins. 11 = full-bridge output reverse. p1b modulated. p1c active. p1a, p1d inactive. bit 5-4 dc1b<1:0>: pwm duty cycle least significant bits capture mode: unused compare mode: unused pwm mode: these bits are the two lsbs of the pwm duty cycle. the eight msbs are found in ccprnl. bit 3-0 ccp1m<3:0>: eccp mode select bits 0000 = capture/compare/pwm off (resets eccp module) 0001 = unused (reserved) 0010 = compare mode, toggle output on match (ccp1if bit is set) 0011 = unused (reserved) 0100 = capture mode, every falling edge 0101 = capture mode, every rising edge 0110 = capture mode, every 4th rising edge 0111 = capture mode, every 16th rising edge 1000 = compare mode, set output on match (ccp1if bit is set) 1001 = compare mode, clear output on match (ccp1if bit is set) 1010 = compare mode, generate software interrupt on match (ccp1if bit is set, ccp1 pin is unaffected) 1011 = compare mode, trigger special event (ccp1if bit is set; eccp resets tmr1, and starts an a/d conversion, if the a/d module is enabled.) 1100 = pwm mode. p1a, p1c active high. p1b, p1d active high. 1101 = pwm mode. p1a, p1c active high. p1b, p1d active low. 1110 = pwm mode. p1a, p1c active low. p1b, p1d active high. 1111 = pwm mode. p1a, p1c active low. p1b, p1d active low. legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
pic16c717/770/771 ds41120b-page 54 ? 2002 microchip technology inc. table 8-1: eccp mode - timer resource 8.1 capture mode in capture mode, ccpr1h:ccpr1l captures the 16- bit value of the tmr1 register when an event occurs on pin ccp1. an event is defined as: ? every falling edge  every rising edge  every 4th rising edge  every 16th rising edge an event is selected by control bits ccp1m<3:0> (ccp1con<3:0>). when a capture is made, the inter- rupt request flag bit ccp1if (pir1<2>) is set. it must be cleared in software. if another capture occurs before the value in register ccpr1 is read, the old captured value will be lost. 8.1.1 ccp1 pin configuration in capture mode, the ccp1 pin should be configured as an input by setting the trisb<3> bit. 8.1.2 timer1 mode selection timer1 must be running in timer mode or synchro- nized counter mode. in asynchronous counter mode, the capture operation may not work. 8.1.3 software interrupt when the capture mode is changed, a false capture interrupt may be generated. the user should keep bit ccp1ie (pie1<2>) clear to avoid false interrupts and should clear the flag bit ccp1if following any such change in operating mode. 8.1.4 eccp prescaler there are three prescaler settings, specified by bits ccp1m<3:0>. whenever the eccp module is turned off or the eccp module is not in capture mode, the prescaler counter is cleared. this means that any reset will clear the prescaler counter. switching from one capture prescaler to another may generate an interrupt. also, the prescaler counter will not be cleared, therefore the first capture may be from a non-zero prescaler. example 8-1 shows the recom- mended method for switching between capture pres- calers. this example also clears the prescaler counter and will not generate the ?false? interrupt. example 8-1: changing between capture prescalers figure 8-1: capture mode operation block diagram 8.2 compare mode in compare mode, the 16-bit ccpr1 register value is constantly compared against the tmr1 register pair value. when a match occurs, the ccp1 pin is:  driven high driven low  toggle output (high to low or low to high)  remains unchanged the action on the pin is based on the value of control bits ccp1m<3:0>. at the same time, interrupt flag bit ccp1if is set. changing the eccp mode select bits to the clear out- put on match mode (ccp1m<3.0> = ?1000?) presets the ccp1 output latch to the logic 1 level. changing the eccp mode select bits to the clear output on match mode (ccp1m<3:0> = ?1001?) presets the ccp1 out- put latch to the logic 0 level. 8.2.1 ccp1 pin configuration the user must configure the ccp1 pin as an output by clearing the appropriate trisb bit. 8.2.2 timer1 mode selection timer1 must be running in timer mode or synchro- nized counter mode if the eccp module is using the compare feature. in asynchronous counter mode, the compare operation may not work. eccp mode timer resource capture compare pwm timer1 timer1 timer2 note: if the rb3/ccp1/p1a pin is configured as an output, a write to the port can cause a capture condition. note: clearing the ccp1con register will force the ccp1 compare output latch to the default low level. this is not the port data latch. clrf ccp1con ; turn eccp module off movlw new_capt_ps ; load wreg with the ; new prescaler mode ; value and eccp on movwf ccp1con ; load ccp1con with ; this value ccpr1h ccpr1l tmr1h tmr1l set flag bit ccp1if (pir1<2>) capture enable q ? s ccp1con<3:0> rb3/ccp1/ prescaler 3 1, 4, 16 and edge detect p1a pin
? 2002 microchip technology inc. ds41120b-page 55 pic16c717/770/771 8.2.3 software interrupt mode when generate software interrupt is chosen, the ccp1 pin is not affected. only an eccp interrupt is generated (if enabled). 8.2.4 special event trigger in this mode, an internal hardware trigger is generated, which may be used to initiate an action. the special event trigger output of eccp resets the tmr1 register pair. this allows the ccpr1 register to effectively be a 16-bit programmable period register for timer1. the special event trigger output of eccp module will also start an a/d conversion if the a/d module is enabled. figure 8-2: compare mode operation block diagram table 8-2: registers associated with capture, compare and timer1 note: the special event trigger will not set the interrupt flag bit tmr1if (pir1<0>). ccpr1h ccpr1l tmr1h tmr1l comparator qs r output logic special event trigger set flag bit ccp1if (pir1<2>) match rb3/ccp1/ trisb<3> ccp1con<3:0> mode select output enable p1a pin special event trigger will: reset timer1, but not set interrupt flag bit tmr1if (pir1<0>). name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on por, bor value on all other resets intcon gie peie t0ie inte rbie t0if intf rbif 0000 000x 0000 000u pir1 pspif (1) adif rcif txif sspif ccp1if tmr2if tmr1if 0000 0000 0000 0000 pie1 pspie (1) adie rcie txie sspie ccp1ie tmr2ie tmr1ie 0000 0000 0000 0000 trisb portb data direction register 1111 1111 1111 1111 tmr1l holding register for the least significant byte of the 16-bit tmr1 register xxxx xxxx uuuu uuuu tmr1h holding register for the most significant byte of the 16-bit tmr1register xxxx xxxx uuuu uuuu t1con ? ? t1ckps 1 t1ckp s0 t1oscen t1sync tmr1cs tmr1o n --00 0000 --uu uuuu ccpr1l capture/compare/pwm register1 (lsb) xxxx xxxx uuuu uuuu ccpr1h capture/compare/pwm register1 (msb) xxxx xxxx uuuu uuuu ccp1con pwm1m1 pwm1m0 dc1b1 dc1b0 ccp1m3 ccp1m2 ccp1m1 ccp1m0 0000 0000 0000 0000 legend: x = unknown, u = unchanged, - = unimplemented read as ? 0 ? . shaded cells are not used by capture and timer1.
pic16c717/770/771 ds41120b-page 56 ? 2002 microchip technology inc. 8.3 pwm mode in pulse width modulation (pwm) mode, the eccp module produces up to a 10-bit resolution pwm output. figure 8-3 shows the simplified pwm block diagram. figure 8-3: simplified pwm block diagram 8.3.1 pwm period the pwm period is specified by writing to the pr2 reg- ister. the pwm period can be calculated using the fol- lowing formula: pwm period = [(pr2) + 1]  4  t osc  (tmr2 prescale value ) pwm frequency is defined as 1 / [pwm period]. when tmr2 is equal to pr2, the following three events occur on the next increment cycle:  tmr2 is cleared  the ccp1 pin is set (exception: if pwm duty cycle = 0%, the ccp1 pin will not be set)  the pwm duty cycle is latched from ccpr1l into ccpr1h ccpr1l ccpr1h (slave) comparator tmr2 comparator pr2 (note 1) r q s duty cycle registers ccp1con<5:4> clear timer, ccp1 pin and latch d.c. note: 8-bit timer tmr2 is concatenated with 2-bit internal q clock or 2 bits of the prescaler to create 10-bit time-base. trisb<3> rb3/ccp1/p1a trisb<5> rb5/sdo/p1b trisb<6> rb6/t1oso/t1cki/ trisb<7> rb7/t1osi/p1d p1c output controller pwm1m1<1:0> 2 ccp1m<3:0> 4 p1del ccp1/p1a p1b p1c p1d note: the timer2 postscaler (see section 7.0) is not used in the determination of the pwm frequency. the postscaler could be used to have a servo update rate at a different fre- quency than the pwm output.
? 2002 microchip technology inc. ds41120b-page 57 pic16c717/770/771 8.3.2 pwm duty cycle the pwm duty cycle is specified by writing to the ccpr1l register and to the ccp1con<5:4> bits. up to 10-bit resolution is available. the ccpr1l contains the eight msbs and the ccp1con<5:4> contains the two lsbs. this 10-bit value is represented by ccpr1l:ccp1con<5:4>. the following equation is used to calculate the pwm duty cycle in time: pwm duty cycle = (ccpr1l:ccp1con<5:4>)  t osc  (tmr2 prescale value) ccpr1l and ccp1con<5:4> can be written to at any time, but the duty cycle value is not latched into ccpr1h until after a match between pr2 and tmr2 occurs (i.e., the period is complete). in pwm mode, ccpr1h is a read-only register. the ccpr1h register and a 2-bit internal latch are used to double buffer the pwm duty cycle. this double buffering is essential for glitchless pwm operation. when the ccpr1h and 2-bit latch match tmr2 con- catenated with an internal 2-bit q clock or 2 bits of the tmr2 prescaler, the ccp1 pin is cleared. maximum pwm resolution (bits) for a given pwm fre- quency: 8.3.3 pwm output configurations the pwm1m1 bits in the ccp1con register allows one of the following configurations:  single output  half-bridge output  full-bridge output, forward mode  full-bridge output, reverse mode in the single output mode, the rb3/ccp1/p1a pin is used as the pwm output. since the ccp1 output is multiplexed with the portb<3> data latch, the trisb<3> bit must be cleared to make the ccp1 pin an output. figure 8-4: single pwm output figure 8-5: example of single output application in the half-bridge output mode, two pins are used as outputs. the rb3/ccp1/p1a pin has the pwm output signal, while the rb5/sdo/p1b pin has the comple- mentary pwm output signal. this mode can be used for half-bridge applications, as shown on figure 8-7, or for full-bridge applications, where four power switches are being modulated with two pwm signal. since the p1a and p1b outputs are multiplexed with the portb<3> and portb<5> data latches, the trisb<3> and trisb<5> bits must be cleared to con- figure p1a and p1b as outputs. in half-bridge output mode, the programmable dead- band delay can be used to prevent shoot-through cur- rent in bridge power devices. see section 8.3.5 for more details of the deadband delay operations. note: if the pwm duty cycle value is longer than the pwm period, the ccp1 pin will not be cleared. f osc f pwm --------------- ?? ?? log 2 () log ----------------------------- bits = period duty cycle (1) (1) note 1: at this time, the tmr2 register is equal to the pr2 register. ccp1 (2) 2: output signal is shown as asserted high. c pic16c717/770/771 ccp1 r vout using pwm as a d/a converter pic16c717/770/771 ccp1 using pwm to drive a power v+ l o a d load
pic16c717/770/771 ds41120b-page 58 ? 2002 microchip technology inc. 8.3.4 output polarity configuration the ccp1m<1:0> bits in the ccp1con register allow user to choose the logic conventions (asserted high/ low) for each of the outputs. see register 8-1 for fur- ther details. the pwm output polarities must be selected before the pwm outputs are enabled. charging the polarity con- figuration while the pwm outputs are active is not rec- ommended, since it may result in unpredictable operation. figure 8-6: half-bridge pwm output note 1: at this time, the tmr2 register is equal to the pr2 register. period duty cycle td td (1) p1a(2) p1b(2) td = deadband delay period (1) (1) 2: output signals are shown as asserted high.
? 2002 microchip technology inc. ds41120b-page 59 pic16c717/770/771 figure 8-7: example of half-bridge output mode applications pic16c717/770/771 p1a p1b fet driver fet driver v+ v- load + - + v - + v - pic16c717/770/771 p1a p1b fet driver fet driver v+ v- load + - fet driver fet driver
pic16c717/770/771 ds41120b-page 60 ? 2002 microchip technology inc. in full-bridge output mode, four pins are used as out- puts; however, only two outputs are active at a time. in the forward mode, rb3/ccp1/p1a pin is continuously active, and rb7/t1osi/p1d pin is modulated. in the reverse mode, rb6/t1oso/t1cki/p1c pin is contin- uously active, and rb5/sdo/p1b pin is modulated. p1a, p1b, p1c and p1d outputs are multiplexed with portb<3> and portb<5:7> data latches. trisb<3> and trisb<5:7> bits must be cleared to make the p1a, p1b, p1c, and p1d pins output. figure 8-8: full-bridge pwm output period duty cycle p1a (2) p1b (2) p1c (2) p1d (2) forward mode (1) period duty cycle p1a (2) p1c (2) p1d (2) p1b (2) reverse mode 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 (1) (1) (1) note 1: at this time, the tmr2 register is equal to the pr2 register. 2: output signal is shown as asserted high.
? 2002 microchip technology inc. ds41120b-page 61 pic16c717/770/771 figure 8-9: example of full-bridge application pic16c717/770/771 p1d p1a fet driver fet driver v+ v- load + - fet driver fet driver p1c p1b
pic16c717/770/771 ds41120b-page 62 ? 2002 microchip technology inc. 8.3.5 programmable deadband delay in half-bridge or full-bridge applications, driven by half- bridge outputs (see figure 8-7), the power switches normally require longer time to turn off than to turn on. if both the upper and lower power switches are switched at the same time (one turned on, and the other turned off), both switches will be on for a short period of time, until one switch completely turns off. during this time, a very high current, called shoot- through current, will flow through both power switches, shorting the bridge supply. to avoid this potentially destructive shoot-through current from flowing during switching, turning on the power switch is normally delayed to allow the other switch to completely turn off. in the half-bridge output mode, a digitally program- mable deadband delay is available to avoid shoot- through current from destroying the bridge power switches. the delay occurs at the signal transition from the non-active state to the active state. see figure 8-6 for illustration. the p1del register sets the amount of delay. register 8-2: pwm delay register (p1del: 97h) 8.3.6 direction change in full- bridge output mode in the full-bridge output mode, the pwm1m1 bit in the ccp1con register allows user to control the forward/ reverse direction. when the application firmware changes this direction control bit, the eccp module will assume the new direction on the next pwm cycle. the current pwm cycle still continues, however, the non- modulated outputs, p1a and p1c signals, will transition to the new direction tosc, 4 ? tosc or 16 ? tosc (for timer2 prescale t2ckrs<1:0> = 00, 01 and 1x respectively) earlier, before the end of the period. dur- ing this transition cycle, the modulated outputs, p1b and p1d, will go to the inactive state. see figure 8-10 for illustration. figure 8-10: pwm direction change r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 p1del7 p1del6 p1del5 p1del4 p1del3 p1del2 p1del1 p1del0 bit 7 bit 0 bit 7-0 p1del<7:0>: pwm delay count for half-bridge output mode: number of f osc /4 (tosc ? 4) cycles between the p1a transition and the p1b transition. legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown dc period signal p1a (active high) note 1: the direction bit in the eccp control register (ccp1con) is written anytime during the pwm cycle. 2: the p1a and p1c signals switch t osc , 4*tosc or 16*t osc , depending on the timer2 prescaler value, earlier when changing direction. the modulated p1b and p1d signals are inactive at this time. (1) period (2) p1d (active high) p1c (active high) p1b (active high)
? 2002 microchip technology inc. ds41120b-page 63 pic16c717/770/771 note that in the full-bridge output mode, the eccp module does not provide any deadband delay. in gen- eral, since only one output is modulated at a time, deadband delay is not required. however, there is a sit- uation where a deadband delay might be required. this situation occurs when all of the following conditions are true: 1. the direction of the pwm output changes when the duty cycle of the output is at or near 100%. 2. the turn off time of the power switch, including the power device and driver circuit, is greater than turn on time. figure 8-11 shows an example, where the pwm direc- tion changes from forward to reverse at a near 100% duty cycle. at time t1, the output p1a and p1d become inactive, while output p1c becomes active. in this example, since the turn off time of the power devices is longer than the turn on time, a shoot-through current flows through the power devices, qb and qd, for the duration of t= t off -t on . the same phenomenon will occur to power devices, qc and qb, for pwm direction change from reverse to forward. if changing pwm direction at high duty cycle is required for the user ? s application, one of the following require- ments must be met: 1. avoid changing pwm output direction at or near 100% duty cycle. 2. use switch drivers that compensate for the slow turn off of the power devices. the total turn off time (t off ) of the power device and the driver must be less than the turn on time (t on ). figure 8-11: pwm direction change at near 100% duty cycle forward period reverse period (pwm) p1a 1 0 (pwm) t on t off t = t off - t on 1 0 1 0 1 0 1 0 1 0 1 0 p1b p1c p1d external switch d potential shoot through current note 1: all signals are shown as active high. 2: t on is the turn on delay of power switch and driver. 3: t off is the turn off delay of power switch and driver. external switch c t 1
pic16c717/770/771 ds41120b-page 64 ? 2002 microchip technology inc. 8.3.7 system implementation when the eccp module is used in the pwm mode, the application hardware must use the proper external pull- up and/or pull-down resistors on the pwm output pins. when the microcontroller powers up, all of the i/o pins are in the high-impedance state. the external pull-up and pull-down resistors must keep the power switch devices in the off state until the microcontroller drives the i/o pins with the proper signal levels, or activates the pwm output(s). 8.3.8 start-up considerations prior to enabling the pwm outputs, the p1a, p1b, p1c and p1d latches may not be in the proper states. enabling the trisb bits for output at the same time with the ccp module may cause damage to the power switch devices. the ccp1 module must be enabled in the proper output mode with the trisb bits enabled as inputs. once the ccp1 completes a full pwm cycle, the p1a, p1b, p1c and p1d output latches are prop- erly initialized. at this time, the trisb bits can be enabled for outputs to start driving the power switch devices. the completion of a full pwm cycle is indi- cated by the tmr2if bit going from a ? 0 ? to a ? 1 ? . 8.3.9 set up for pwm operation the following steps should be taken when configuring the eccp module for pwm operation: 1. configure the pwm module: a) disable the ccp1/p1a, p1b, p1c and/or p1d outputs by setting the respective trisb bits. b) set the pwm period by loading the pr2 register. c) set the pwm duty cycle by loading the ccpr1l register and ccp1con<5:4> bits. d) configure the eccp module for the desired pwm operation by loading the ccp1con register. with the ccp1m<3:0> bits select the active high/low levels for each pwm output. with the pwm1m<1:0> bits select one of the available output modes: single, half-bridge, full-bridge, forward or full- bridge reverse. e) for half-bridge output mode, set the dead- band delay by loading the p1del register. 2. configure and start tmr2: a) clear the tmr2 interrupt flag bit by clearing the tmr2if bit in the pir1 register. b) set the tmr2 prescale value by loading the t2ckps<1:0> bits in the t2con register. c) enable timer2 by setting the tmr2on bit in the t2con register. 3. enable pwm outputs after a new cycle has started: a) wait until tmr2 overflows (tmr2if bit becomes a ? 1 ? ). the new pwm cycle begins here. b) enable the ccp1/p1a, p1b, p1c and/or p1d pin outputs by clearing the respective trisb bits. table 8-3: registers associated with pwm address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on por, bor value on all other resets 0bh, 8bh, 10bh, 18bh intcon gie peie t0ie inte rbie t0if intf rbif 0000 000x 0000 000u 0ch pir1 ? adif ? ? sspif ccp1if tmr2if tmr1if -0-- 0000 -0-- 0000 8ch pie1 ? adie ? ? sspie ccp1ie tmr2ie tmr1ie -0-- 0000 -0-- 0000 86h, 186h trisb portb data direction register 1111 1111 1111 1111 11h tmr2 timer2 register 0000 0000 0000 0000 92h pr2 timer2 period register 1111 1111 1111 1111 12h t2con ? toutps3 toutps2 toutps1 toutps0 tmr2on t2ckps1 t2ckps0 -000 0000 -000 0000 15h ccpr1l capture/compare/pwm register1 (lsb) xxxx xxxx uuuu uuuu 17h ccp1con pwm1m1 pwm1m0 dc1b1 dc1b0 ccp1m3 ccp1m2 ccp1m1 ccp1m0 0000 0000 0000 0000 97h p1del pwm1 delay value 0000 0000 0000 0000 legend: x = unknown, u = unchanged, - = unimplemented read as '0'. shaded cells are not used by eccp module in pwm mode.
? 2002 microchip technology inc. advance information ds41120b-page 65 pic16c717/770/771 9.0 master synchronous serial port (mssp) module the master synchronous serial port (mssp) module is a serial interface useful for communicating with other peripheral or microcontroller devices. these peripheral devices may be serial eeproms, shift registers, dis- play drivers, etc. the mssp module can operate in one of two modes:  serial peripheral interface (spi ? )  inter-integrated circuit (i 2 c ? )
pic16c717/770/771 ds41120b-page 66 advance information ? 2002 microchip technology inc. register 9-1: sync serial port status register (sspstat: 94h) r/w-0 r/w-0 r-0 r-0 r-0 r-0 r-0 r-0 smp cke d/a psr/w ua bf bit 7 bit 0 bit 7 smp : sample bit spi master mode 1 = input data sampled at end of data output time 0 = input data sampled at middle of data output time spi slave mode smp must be cleared when spi is used in slave mode in i 2 c master or slave mode: 1 = slew rate control disabled for standard speed mode (100 khz and 1 mhz) 0 = slew rate control enabled for high speed mode (400 khz) bit 6 cke: spi clock edge select (figure 9-3, figure 9-5, and figure 9-6) ckp = 0 1 = data transmitted on rising edge of sck 0 = data transmitted on falling edge of sck ckp = 1 1 = data transmitted on falling edge of sck 0 = data transmitted on rising edge of sck bit 5 d/a : data/address bit (i 2 c mode only) 1 = indicates that the last byte received or transmitted was data 0 = indicates that the last byte received or transmitted was address bit 4 p: stop bit (i 2 c mode only. this bit is cleared when the mssp module is disabled, sspen is cleared) 1 = indicates that a stop bit has been detected last (this bit is ? 0 ? on reset) 0 = stop bit was not detected last bit 3 s: start bit (i 2 c mode only. this bit is cleared when the mssp module is disabled, sspen is cleared) 1 = indicates that a start bit has been detected last (this bit is ? 0 ? on reset) 0 = start bit was not detected last bit 2 r/w : read/write bit information (i 2 c mode only) this bit holds the r/w bit information following the last address match. this bit is only valid from the address match to the next start bit, stop bit, or nack bit. in i 2 c slave mode: 1 = read 0 = write in i 2 c master mode: 1 = transmit is in progress 0 = transmit is not in progress. oring this bit with sen, rsen, pen, rcen, or aken will indicate if the mssp is in idle mode bit 1 ua: update address (10-bit i 2 c mode only) 1 = indicates that the user needs to update the address in the sspadd register 0 = address does not need to be updated bit 0 bf: buffer full status bit receive (spi and i 2 c modes) 1 = receive complete, sspbuf is full 0 = receive not complete, sspbuf is empty transmit ( i 2 c mode only) 1 = data transmit in progress (does not include the ack and stop bits), sspbuf is full 0 = data transmit complete (does not include the ack and stop bits), sspbuf is empty legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
? 2002 microchip technology inc. advance information ds41120b-page 67 pic16c717/770/771 register 9-2: sync serial port control register (sspcon: 14h) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 wcol sspov sspen ckp sspm3 sspm2 sspm1 sspm0 bit 7 bit 0 bit 7 wcol: write collision detect bit master mode: 1 = a write to the sspbuf register was attempted while the i 2 c conditions were not valid for a transmission to be started 0 = no collision slave mode: 1 = the sspbuf register is written while it is still transmitting the previous word (must be cleared in software) 0 = no collision bit 6 sspov: receive overflow indicator bit in spi mode 1 = a new byte is received while the sspbuf register is still holding the previous data. in case of overflow, the data in sspsr is lost. overflow can only occur in slave mode. in slave mode, the user must read the sspbuf, even if only transmitting data, to avoid setting over- flow. in master mode, the overflow bit is not set since each new reception (and transmis- sion) is initiated by writing to the sspbuf register. (must be cleared in software). 0 = no overflow in i 2 c m ode 1 = a byte is received while the sspbuf register is still holding the previous byte. sspov is a "don ? t care" in transmit mode. (must be cleared in software). 0 = no overflow bit 5 sspen: synchronous serial port enable bit in both modes, when enabled, the i/o pins must be properly configured as input or output. in spi mode 1 = enables serial port and configures sck, sdo, sdi, and ss as the source of the serial port pins 0 = disables serial port and configures these pins as i/o port pins in i 2 c m ode 1 = enables the serial port and configures the sda and scl pins as the source of the serial port pins 0 = disables serial port and configures these pins as i/o port pins bit 4 ckp: clock polarity select bit in spi mode 1 = idle state for clock is a high level 0 = idle state for clock is a low level in i 2 c slave mod e s ck release contro l 1 = enable clock 0 = holds clock low (clock stretch) (used to ensure data setup time) in i 2 c master mode unused in this mode legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
pic16c717/770/771 ds41120b-page 68 advance information ? 2002 microchip technology inc. register 9-2: sync serial port control register (sspcon: 14h) (continued) bit 3-0 sspm<3:0>: synchronous serial port mode select bits 0000 = spi master mode, clock = f osc /4 0001 = spi master mode, clock = f osc /16 0010 = spi master mode, clock = f osc /64 0011 = spi master mode, clock = tmr2 output/2 0100 = spi slave mode, clock = sck pin. ss pin control enabled. 0101 = spi slave mode, clock = sck pin. ss pin control disabled. ss can be used as i/o pin. 0110 = i 2 c slave mode, 7-bit address 0111 = i 2 c slave mode, 10-bit address 1000 = i 2 c master mode, clock = f osc / (4 ? (sspadd+1) ) 1001 = reserved 1010 = reserved 1011 = firmware controlled master mode (slave idle) 1100 = reserved 1101 = reserved 1110 = 7-bit slave mode with start and stop condition interrupts 1111 = 10-bit slave mode with start and stop condition interrupts legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
? 2002 microchip technology inc. advance information ds41120b-page 69 pic16c717/770/771 register 9-3: sync serial port control register2 (sspcon2: 91h) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 gcen ackstat ackdt acken rcen pen rsen sen bit 7 bit 0 bit 7 gcen: general call enable bit (in i 2 c slave mode only) 1 = enable interrupt when a general call address (0000h) is received in the sspsr. 0 = general call address disabled. bit 6 ackstat: acknowledge status bit (in i 2 c master mode only) in master transmi t m ode : 1 = acknowledge was not received from slave 0 = acknowledge was received from slave bit 5 ackdt: acknowledge data bit (in i 2 c master mode only) in master r ec eive mode : value that will be transmitted when the user initiates an acknowledge sequence at the end of a receive. 1 = not acknowledge (nack) 0 = acknowledge (ack ) bit 4 acken: acknowledge sequence enable bit (in i 2 c master mode only). in master rec ei ve mode : 1 = initiate acknowledge sequence on sda and scl pins, and transmit ackdt data bit. automatically cleared by hardware. 0 = acknowledge sequence idle bit 3 rcen: receive enable bit (in i 2 c master mode only). 1 = enables receive mode for i 2 c 0 = receive idle bit 2 pen: stop condition enable bit (in i 2 c master mode only). sck release co ntrol 1 = initiate stop condition on sda and scl pins. automatically cleared by hardware. 0 = stop condition idle bit 1 rsen: repeated start condition enabled bit (in i 2 c master mode only) 1 = initiate repeated start condition on sda and scl pins. automatically cleared by hardware. 0 = repeated start condition idle bit 0 sen: start condition enabled bit (in i 2 c master mode only) 1 = initiate start condition on sda and scl pins. automatically cleared by hardware. 0 = start condition idle note: for bits acken, rcen, pen, rsen, sen: if the i 2 c module is not in the idle mode, this bit may not be set (no spooling) and the sspbuf may not be written (or writes to the sspbuf are disabled). legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
pic16c717/770/771 ds41120b-page 70 advance information ? 2002 microchip technology inc. 9.1 spi mode the spi mode allows eight bits of data to be synchro- nously transmitted and received simultaneously. all four modes of spi are supported. to accomplish com- munication, typically three pins are used:  serial data out (sdo)  serial data in (sdi)  serial clock (sck) additionally, a fourth pin may be used when in a slave mode of operation:  slave select (ss ) 9.1.1 operation when initializing the spi, several options need to be specified. this is done by programming the appropriate control bits (sspcon<5:0> and sspstat<7:6>). these control bits allow the following to be specified:  master mode (sck is the clock output)  slave mode (sck is the clock input)  clock polarity (idle state of sck)  data input sample phase (middle or end of data output time)  clock edge (output data on rising/falling edge of sck)  clock rate (master mode only)  slave select mode (slave mode only) figure 9-1 shows the block diagram of the mssp mod- ule when in spi mode. figure 9-1: mssp block diagram (spi mode) the mssp consists of a transmit/receive shift register (sspsr) and a buffer register (sspbuf). the sspsr shifts the data in and out of the device, msb first. the sspbuf holds the data that was written to the sspsr, until the received data is ready. once the eight bits of data have been received, that byte is moved to the sspbuf register. then the buffer full detect bit, bf (sspstat<0>), and the interrupt flag bit, sspif (pir1<3>), are set. this double buffering of the received data (sspbuf) allows the next byte to start reception before reading the data that was just received. any write to the sspbuf register during transmission/reception of data will be ignored, and the write collision detect bit wcol (sspcon<7>) will be set. user software must clear the wcol bit so that it can be determined if the following write(s) to the ssp- buf register completed successfully. read write internal data bus sspsr reg sspbuf reg sspm<3:0> bit0 shift clock ss control enable edge select clock select tmr2 output to sc prescaler 4, 16, 64 2 edge select 2 4 data to tx/rx in sspsr data direction bit 2 smp:cke sdi sdo ss sck
? 2002 microchip technology inc. advance information ds41120b-page 71 pic16c717/770/771 when the application software is expecting to receive valid data, the sspbuf should be read before the next byte of data to transfer is written to the sspbuf. buffer full bit, bf (sspstat<0>), indicates when the ssp- buf has been loaded with the received data (transmis- sion is complete). when the sspbuf is read, bit bf is cleared. this data may be irrelevant if the spi is only a transmitter. generally the mssp interrupt is used to determine when the transmission/reception has com- pleted. the sspbuf must be read and/or written. if the interrupt method is not going to be used, then software polling can be done to ensure that a write collision does not occur. example 9-1 shows the loading of the ssp- buf (sspsr) for data transmission. example 9-1: loading the sspbuf (sspsr) register the sspsr is not directly readable or writable, and can only be accessed by addressing the sspbuf reg- ister. additionally, the mssp status register (sspstat) indicates the various status conditions. 9.1.2 enabling spi i/o to enable the serial port, mssp enable bit, sspen (sspcon<5>) must be set. to reset or reconfigure spi mode, clear bit sspen, re-initialize the sspcon reg- isters, and then set bit sspen. this configures the sdi, sdo, sck and ss pins as serial port pins. for the pins to behave as the serial port function, some must have their data direction bits (in the tris register) appropriately programmed. that is:  sdi is automatically controlled by the spi module  sdo must have trisb<5> cleared  sck (master mode) must have trisb<2> cleared  sck (slave mode) must have trisb<2> set  ss must have trisb<1> set, and ansel<5> cleared any serial port function that is not desired may be over- ridden by programming the corresponding data direc- tion (tris) register to the opposite value. 9.1.3 typical connection figure 9-2 shows a typical connection between two microcontrollers. the master controller (processor 1) initiates the data transfer by sending the sck signal. data is shifted out of both shift registers on their pro- grammed clock edge, and latched on the opposite edge of the clock. both processors should be pro- grammed to same clock polarity (sspcon<4>), then both controllers would send and receive data at the same time. whether the data is meaningful (or dummy data) depends on the application software. this leads to three scenarios for data transmission:  master sends data ? slave sends dummy data  master sends data ? slave sends data  master sends dummy data ? slave sends data figure 9-2: spi master/slave connection bsf status, rp0 ;specify bank 1 loop btfss sspstat, bf ;has data been ;received ;(xmit complete)? goto loop ;no bcf status, rp0 ;specify bank 0 movf sspbuf, w ;save sspbuf... movwf rxdata ;...in user ram movf txdata, w ;get next txdata movwf sspbuf ;new data to xmit serial input buffer (sspbuf) shift register (sspsr) msb lsb sdo sdi processor 1 sck spi master sspm<3:0> = 00xxb serial input buffer (sspbuf) shift register (sspsr) lsb msb sdi sdo processor 2 sck spi slave sspm<3:0> = 010xb serial clock
pic16c717/770/771 ds41120b-page 72 advance information ? 2002 microchip technology inc. 9.1.4 master mode the master can initiate the data transfer at any time because it controls the sck. the master determines when the slave (processor 2, figure 9-2) is to broad- cast data by the software protocol. in master mode, the data is transmitted/received as soon as the sspbuf register is written to. if the spi module is only going to receive, the sdo output could be disabled (programmed as an input). the sspsr register will continue to shift in the signal present on the sdi pin at the programmed clock rate. as each byte is received, it will be loaded into the sspbuf register as if a normal received byte (interrupts and status bits appropriately set). this could be useful in receiver applications as a ? line activity monitor ? . the clock polarity is selected by appropriately program- ming bit ckp (sspcon<4>). this then would give waveforms for spi communication as shown in figure 9-3, figure 9-5 and figure 9-6, where the msb is transmitted first. in master mode, the spi clock rate (bit rate) is user programmable to be one of the follow- ing:  f osc /4 (or t cy )  f osc /16 (or 4  t cy )  f osc /64 (or 16  t cy )  timer2 output/2 this allows a maximum bit clock frequency (at 20 mhz) of 8.25 mhz. figure 9-3 shows the waveforms for master mode. when cke = 1, the sdo data is valid before there is a clock edge on sck. the change of the input sample is shown based on the state of the smp bit. the time when the sspbuf is loaded with the received data is shown. figure 9-3: spi mode waveform (master mode) sck (ckp = 0 sck (ckp = 1 sck (ckp = 0 sck (ckp = 1 4 clock modes input sample input sample sdi bit7 bit0 sdo bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 bit7 bit0 sdi sspif (smp = 1) (smp = 0) (smp = 1) cke = 1) cke = 0) cke = 1) cke = 0) (smp = 0) write to sspbuf sspsr to sspbuf sdo bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 (cke = 0) (cke = 1) next q4 cycle after q2
? 2002 microchip technology inc. advance information ds41120b-page 73 pic16c717/770/771 9.1.5 slave mode in slave mode, the data is transmitted and received as the external clock pulses appear on sck. when the last bit is latched the interrupt flag bit sspif (pir1<3>) is set. while in slave mode, the external clock is supplied by the external clock source on the sck pin. this external clock must meet the minimum high and low times as specified in the electrical specifications. while in sleep mode, the slave can transmit/receive data. when a byte is received, the device will wake-up from sleep. 9.1.6 slave select synchronization the ss pin allows a synchronous slave mode. the spi must be in slave mode with ss pin control enabled (sspcon<3:0> = 0100 ). the pin must not be driven low for the ss pin to function as an input. trisb<1> must be set. when the ss pin is low, transmission and reception are enabled and the sdo pin is driven. when the ss pin goes high, the sdo pin is no longer driven, even if in the middle of a transmitted byte, and becomes a floating output. external pull-up/ pull-down resistors may be desir- able, depending on the application. when the spi module resets, the bit counter is forced to 0. this can be done by either forcing the ss pin to a high level or clearing the sspen bit. to emulate two-wire communication, the sdo pin can be connected to the sdi pin. when the spi needs to operate as a receiver, the sdo pin can be configured as an input. this disables transmissions from the sdo. the sdi can always be left as an input (sdi function) since it cannot create a bus conflict. figure 9-4: slave synchronization waveform note 1: when the spi module is in slave mode with ss pin control enabled, (ssp- con<3:0> = 0100 ) the spi module will reset if the ss pin is set to v dd . 2: if the spi is used in slave mode with cke = ? 1 ? , then ss pin control must be enabled. sck (ckp = 1 sck (ckp = 0 input sample sdi bit7 sdo bit7 bit6 bit7 sspif interrupt (smp = 0) cke = 0) cke = 0) (smp = 0) write to sspbuf sspsr to sspbuf ss flag bit0 bit7 bit0 next q4 cycle after q2
pic16c717/770/771 ds41120b-page 74 advance information ? 2002 microchip technology inc. figure 9-5: spi slave mode waveform (cke = 0) figure 9-6: spi slave mode waveform (cke = 1) sck (ckp = 1 sck (ckp = 0 input sample sdi bit7 bit0 sdo bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 sspif interrupt (smp = 0) cke = 0) cke = 0) (smp = 0) write to sspbuf sspsr to sspbuf ss flag optional next q4 cycle after q2 sck (ckp = 1 sck (ckp = 0 input sample sdi bit7 bit0 sdo bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 sspif interrupt (smp = 0) cke = 1) cke = 1) (smp = 0) write to sspbuf sspsr to sspbuf ss flag not optional next q4 cycle after q2
? 2002 microchip technology inc. advance information ds41120b-page 75 pic16c717/770/771 9.1.7 sleep operation in master mode, all module clocks are halted and the transmission/reception will remain in that state until the device wakes from sleep. after the device returns to normal mode, the module will continue to transmit/ receive data. in slave mode, the spi transmit/receive shift register operates asynchronously to the device. this allows the device to be placed in sleep mode and data to be shifted into the spi transmit/receive shift register. when all eight bits have been received, the sspif interrupt flag bit will be set and if enabled will wake the device from sleep. 9.1.8 effects of a reset a reset disables the mssp module and terminates the current transfer. table 9-1: registers associated with spi operation address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 por, bor mclr , wdt 0bh, 8bh, 10bh,18bh intcon gie peie t0ie inte rbie t0if intf rbif 0000 000x 0000 000u 0ch pir1 ? adif ? ? sspif ccp1if tmr2if tmr1if -0-- 0000 -0-- 0000 8ch pie1 ? adie ? ? sspie ccp1ie tmr2ie tmr1ie -0-- 0000 -0-- 0000 13h sspbuf synchronous serial port receive buffer/transmit register xxxx xxxx uuuu uuuu 14h sspcon wcol sspov sspen ckp sspm3 sspm2 sspm1 sspm0 0000 0000 0000 0000 94h sspstat smp cke d/a p s r/w ua bf 0000 0000 0000 0000 9dh ansel --11 1111 --11 1111 86h trisb 1111 1111 1111 1111 legend: x = unknown, u = unchanged, - = unimplemented read as ? 0 ? . shaded cells are not used by the mssp in spi mode.
pic16c717/770/771 ds41120b-page 76 advance information ? 2002 microchip technology inc. 9.2 mssp i 2 c operation the mssp module in i 2 c mode fully implements all master and slave functions (including general call sup- port) and provides interrupts on start and stop bits in hardware to determine when the bus is free (multi- master function). the mssp module implements the standard mode specifications, as well as 7-bit and 10- bit addressing. two pins are used to transfer data. they are the scl pin (clock) and the sda pin (data). the mssp module functions are enabled by setting ssp enable bit sspen (sspcon<5>). the scl and sda pins are "glitch" filtered when operating as inputs. this filter functions in both the 100 khz and 400 khz modes. when these pins operate as outputs in the 100 khz mode, there is a slew rate control of the pin that is inde- pendent of device frequency. before selecting any i 2 c mode, the scl and sda pins must be programmed as inputs by setting the appropri- ate tris bits. this allows the mssp module to configure and drive the i/o pins as required by the i 2 c protocol. the mssp module has six registers for i 2 c operation. they are listed below.  ssp control register (sspcon)  ssp control register2 (sspcon2)  ssp status register (sspstat)  serial receive/transmit buffer (sspbuf)  ssp shift register (sspsr) - not directly accessible  ssp address register (sspadd) the sspcon register allows for control of the i 2 c operation. four mode selection bits (sspcon<3:0>) configure the mssp as any one of the following i 2 c modes:  i 2 c slave mode (7-bit address)  i 2 c slave mode (10-bit address)  i 2 c master mode scl freq = f osc / [4 ? (sspadd + 1)]  i 2 c slave mode with start and stop interrupts (7-bit address)  i 2 c slave mode with start and stop interrupts (10-bit address)  firmware controlled master mode the sspstat register gives the status of the data transfer. this information includes detection of a start (s) or stop (p) bit. it specifies whether the received byte was data or address, if the next byte is the completion of 10-bit address, and if this will be a read or write data transfer. sspbuf is the register to which the transfer data is written, and from which the transfer data is read. the sspsr register shifts the data in or out of the device. in receive operations, the sspbuf and sspsr create a doubled, buffered receiver. this allows reception of the next byte to begin before reading the last byte of received data. when the complete byte is received, it is transferred from the sspsr register to the sspbuf register and flag bit sspif is set. if another complete byte is received before the sspbuf register is read a receiver overflow occurs, in which case, the sspov bit (sspcon<6>) is set and the byte in the sspsr is lost. figure 9-7: i 2 c slave mode block diagram 9.2.1 upward compatibility with ssp module the mssp module includes three ssp modes of oper- ation to maintain upward compatibility with the ssp module. these modes are:  firmware controlled master mode (slave idle)  7-bit slave mode with start and stop condition interrupts.  10-bit slave mode with start and stop condition interrupts. the firmware controlled master mode enables the start and stop condition interrupts but all other i 2 c functions are generated through firmware including:  generating the start and stop conditions  generating the scl clock  supplying the sda bits in the proper time and phase relationship to the scl signal. in firmware controlled master mode, the scl and sda lines are manipulated by clearing and setting the corre- sponding tris bits. the output level is always low irre- spective of the value(s) in the port register. a ? 1 ? is output by setting the tris bit and a ? 0 ? is output by clearing the tris bit the 7-bit and 10-bit slave modes with start and stop condition interrupts operate identically to the mssp slave modes except that start and stop conditions generate sspif interrupts. read write sspsr reg match detect sspadd reg start and stop bit detect sspbuf reg internal data bus addr match set, reset s, p bits (sspstat reg) rb2/sck/ shift clock msb lsb scl rb4/sdi/ sda
? 2002 microchip technology inc. advance information ds41120b-page 77 pic16c717/770/771 for more information about these ssp modes see sec- tion 15 of the picmicro ? mid-range mcu family ref- erence manual (ds33023) . 9.2.2 slave mode when an address is matched or the data transfer after an address match is received, the hardware automati- cally will generate the acknowledge (ack ) pulse. then, it loads the sspbuf register with the received value currently in the sspsr register. any combination of the following conditions will cause the mssp module to generate a nack pulse in lieu of the ack pulse: a) the buffer full bit bf (sspstat<0>) is set before the transfer is received. b) the overflow bit sspov (sspcon<6>) is set before the transfer is received. if the bf bit is set, the sspsr register value is not loaded into the sspbuf. however, both the sspif and sspov bits are set. table 9-2 shows what happens when a data transfer byte is received, given the status of bits bf and sspov. the shaded cells show the con- dition where user software did not properly clear the overflow condition. the bf flag bit is cleared by reading the sspbuf register. the sspov flag bit is cleared through software. the scl clock input must have a minimum high and low time for proper operation. the high and low times of the i 2 c specification as well as the requirements of the mssp module are shown in timing parameters #100 and #101 of the electrical specifications. 9.2.2.1 7-bit addressing once the mssp module has been enabled (sspen=1), the slave module waits for a start con- dition to occur. following the start condition, eight bits are shifted into the sspsr register. all incoming bits are sampled on the rising edge of the clock (scl) line. the received address (register sspsr<7:1>) is compared to the stored address (register sspadd<7:1>). sspsr<0> is the r/w bit and is not considered in the comparison. comparison is made on the falling edge of the eighth clock (scl) pulse. if the addresses match, and the bf and sspov bits are clear, the following events occur: a) the sspsr register value is transferred to the sspbuf register on the falling edge of the eighth scl pulse. b) the buffer full bit; bf is set on the falling edge of the eighth scl pulse. c) an ack pulse is generated during the ninth clock cycle. d) ssp interrupt flag bit; sspif (pir1<3>) is set (interrupt is generated if enabled) - on the falling edge of the ninth scl pulse. 9.2.2.2 10-bit addressing in 10-bit mode, the basic receive and transmit opera- tions are the same as in the 7-bit mode. however, the criteria for address match are more complex. two address bytes need to be received by the slave. the five most significant bits (msbs) of the first address byte specify that this is a 10-bit address. the lsb of the first received address byte is the r/w bit, which must be zero, specifying a write so the slave device will receive the second address byte. for a 10- bit address, the first byte equals ? 11110 a9 a8 0 ? , where a9 and a8 are the two msbs of the address. the sequence of events for a 10-bit address is as follows, with steps 7 through 9 applicable only to the slave- transmitter: 1. receive first (high) byte of address (bits sspif, bf, and bit ua (sspstat<1>) are set). 2. update the sspadd register with second (low) byte of address (clears bit ua and releases the scl line). 3. read the sspbuf register (clears bit bf) and clear flag bit sspif. 4. receive second (low) byte of address (bits sspif, bf, and ua are set). 5. update the sspadd register with the first (high) byte of address. this will clear bit ua and release the scl line. 6. read the sspbuf register (clears bit bf) and clear flag bit sspif. 7. receive repeated start condition. 8. receive first (high) byte of address with r/w bit set to 1 (bits sspif and bf are set). this also puts the mssp module in the slave-transmit mode. 9. read the sspbuf register (clears bit bf) and clear flag bit sspif. note: following the repeated start condition (step 7) in 10-bit mode, the user only needs to match the first 7-bit address. the user does not update the sspadd for the second half of the address.
pic16c717/770/771 ds41120b-page 78 advance information ? 2002 microchip technology inc. 9.2.2.3 slave reception when the r/w bit of the address byte is clear (sspsr<0> = 0) and an address match occurs, the r/ w bit of the sspstat register is cleared. the received address is loaded into the sspbuf register on the fall- ing edge of the eighth scl pulse. when the address byte overflow condition exists, then no acknowledge (ack ) pulse is given. an overflow condition is defined as either bit bf (sspstat<0>) or bit sspov (sspcon<6>) is set. an mssp interrupt is generated for each data transfer byte. flag bit sspif (pir1<3>) must be cleared in soft- ware. the sspstat register is used to determine the status of the received byte. table 9-2: data transfer received byte actions figure 9-8: i 2 c slave mode waveforms for reception (7-bit address) note: the sspbuf will be loaded if the sspov bit is set and the bf flag is cleared. if a read of the sspbuf was performed, but the user did not clear the state of the sspov bit before the next receive occurred, the ack is not sent and the ssp- buf is updated. status bits as data transfer is received sspsr sspbuf generate ack pulse set bit sspif (ssp interrupt occurs if enabled) bf sspov 0 0 yes yes yes 1 0 no no yes 1 1 no no yes 0 1 yes no yes note 1: shaded cells show the conditions where the user software did not properly clear the overflow condition. p 9 8 7 6 5 d0 d1 d2 d3 d4 d5 d6 d7 s a7 a6 a5 a4 a3 a2 a1 sda scl 12 3 4 5 6 7 8 9 12 3 4 56 7 89 123 4 bus master terminates transfer bit sspov is set because the sspbuf register is still full. cleared in software sspbuf register is read ack receiving data receiving data d0 d1 d2 d3 d4 d5 d6 d7 ack r/w =0 receiving address sspif bf (sspstat<0>) sspov (sspcon<6>) nack nack is sent because of overflow
? 2002 microchip technology inc. advance information ds41120b-page 79 pic16c717/770/771 figure 9-9: i 2 c slave mode for reception (10-bit address) sda scl sspif bf (sspstat<0>) s 1 234 56 7 89 1 2345 67 89 1 2345 7 89 p 1 1 1 1 0 a9a8 a7 a6a5a4a3a2a1 a0 d7d6d5d4d3 d1d0 receive data byte ack r/w = 0 ack receive first byte of address cleared in software bus master terminates transfer d2 6 (pir1<3>) receive second byte of address cleared by hardware when sspadd is updated with low byte of address. ua (sspstat<1>) clock is held low until update of sspadd has taken place ua is set indicating that the sspadd needs to be updated ua is set indicating that sspadd needs to be updated sspbuf is written with contents of sspsr dummy read of sspbuf to clear bf flag ack cleared in software dummy read of sspbuf to clear bf flag read of sspbuf clears bf flag cleared by hardware when sspadd is updated with high byte of address.
pic16c717/770/771 ds41120b-page 80 advance information ? 2002 microchip technology inc. 9.2.2.4 slave transmission when the r/w bit of the incoming address byte is set and an address match occurs, the r/w bit of the ssp- stat register is set. the received address is loaded into the sspbuf register on the falling edge of the eighth scl pulse. the ack pulse will be sent on the ninth bit, and the scl pin is held low. the slave module automatically stretches the clock by holding the scl line low so that the master will be unable to assert another clock pulse until the slave is finished preparing the transmit data. the transmit data must be loaded into the sspbuf register, which also loads the sspsr register. the ckp bit (sspcon<4>) must then be set to release the scl pin from the forced low condition. the eight data bits are shifted out on the falling edges of the scl input. this ensures that the sda signal is valid during the scl high time (figure 9-10). the ack or nack signal from the master-receiver is latched on the rising edge of the ninth scl input pulse. the master-receiver terminates slave transmission by sending a nack. if the sda line is high (nack), then the data transfer is complete. when the nack is latched by the slave, the slave logic is reset which also resets the r/w bit to ? 0 ? . the slave module then monitors for another occurrence of the start bit. the slave firmware knows not to load another byte into the sspbuf register by sensing that the buffer is empty (bf = 0) and the r/w bit has gone low. if the sda line is low (ack ), the r/w bit remains high indicating that the next transmit data must be loaded into the sspbuf register. an mssp interrupt (sspif flag) is generated for each data transfer byte on the falling edge of the ninth clock pulse. the sspif flag bit must be cleared in software. the sspstat register is used to determine the status of the byte transfer. for more information about the i 2 c slave mode, refer to application note an734, ? using the picmicro ? ssp for slave i 2 c ? communication ? . figure 9-10: i 2 c slave mode waveforms for transmission (7-bit address) sda scl sspif bf (sspstat<0>) ckp (sspcon<4>) a7 a6 a5 a4 a3 a2 a1 ack d7 d6 d5 d4 d3 d2 d1 d0 nack transmitting data r/w = 1 receiving address 123456789 123456789 p cleared in software sspbuf is written in software from ssp interrupt service routine set bit after writing to sspbuf s data in sampled scl held low until sspbuf is written (the sspbuf must be written-to before the ckp bit can be set) r/w 0 master terminates transmission by responding with nack
? 2002 microchip technology inc. advance information ds41120b-page 81 pic16c717/770/771 figure 9-11: i 2 c slave mode waveforms for transmission (10-bit address) sda scl sspif bf (sspstat<0>) s 1 2 34 5 67 8 91 2 3 45 6 78 9 12345 789 p 1111 0a9a8 a7a6a5a4a3a2a1a0 11110 a8 r/w =1 ack ack ack receive first byte of address cleared in software master sends nack a9 6 (pir1<3>) receive second byte of address cleared by hardware when sspadd is updated. ua (sspstat<1>) clock is held low until update of sspadd has taken place ua is set indicating that the sspadd needs to be updated ua is set indicating that sspadd needs to be updated cleared by hardware when sspadd is updated. sspbuf is written with contents of sspsr dummy read of sspbuf to clear bf flag receive first byte of address 12345 789 d7 d6 d5 d4 d3 d1 nack d2 6 transmitting data byte d0 dummy read of sspbuf to clear bf flag sr cleared in software write of sspbuf initiates transmit cleared in software transmit is complete ckp has to be set for clock to be released master releases bus with stop condition r/w =0 r/w 0 restart condition
pic16c717/770/771 ds41120b-page 82 advance information ? 2002 microchip technology inc. 9.2.3 general call address support the addressing procedure for the i 2 c bus is such that the first byte after the start condition usually deter- mines which device will be the slave addressed by the master. the exception is the general call address, which can address all devices. when this address is used, all devices should, in theory, respond with an acknowledge. the general call address is one of eight addresses reserved for specific purposes by the i 2 c protocol. it consists of all 0 ? s with r/w = 0 the general call address is recognized when the gen- eral call enable bit (gcen) is set (sspcon2<7> is set). following a start bit detect, eight bits are shifted into the sspsr, and the address is compared against sspadd. it is also compared to the general call address, fixed in hardware. if the general call address matches, the sspsr is transferred to the sspbuf, the bf flag is set (eighth bit), and on the falling edge of the ninth bit (ack bit), the sspif flag is set. when the interrupt is serviced, the source for the inter- rupt can be checked by reading the contents of the sspbuf to determine if the address was device spe- cific or a general call address. if the general call address is sampled with gcen set and the slave configured in 10-bit address mode, the second half of the address is not necessary. the ua bit will not be set and the slave will begin receiving data after the acknowledge (figure 9-12). figure 9-12: slave mode general call address sequence (7- or 10-bit mode) sda scl s sspif bf sspov cleared in software sspbuf is read r/w = 0 ack general call address address is compared to general call address gcen receiving data ack 123456789123456789 d7 d6 d5 d4 d3 d2 d1 d0 after ack , set interrupt flag ? 0 ? ? 1 ? (sspstat<0>) (sspcon<6>) (sspcon2<7>)
? 2002 microchip technology inc. advance information ds41120b-page 83 pic16c717/770/771 9.2.4 sleep operation while in sleep mode, the i 2 c slave module can receive addresses or data. when an address match or complete byte transfer occurs, it wakes the processor from sleep (if the ssp interrupt bit is enabled). 9.2.5 effects of a reset a reset disables the mssp module and terminates the current transfer. 9.2.6 master mode master mode operation supports interrupt generation on the detection of the start and stop conditions. the stop (p) and start (s) bits are cleared from a reset or when the mssp module is disabled. control of the i 2 c bus may be taken when the p bit is set or the bus is idle with both the s and p bits clear. in master mode, the scl and sda lines are manipu- lated by the mssp hardware. the following events will cause ssp interrupt flag bit (sspif) to be set (ssp interrupt, if enabled):  start condition  stop condition  data transfer byte transmitted/received  acknowledge transmit  repeated start figure 9-13: mssp block diagram (i 2 c master mode) read write sspsr start bit, stop bit, start bit detect, sspbuf internal data bus set/reset, s, p, wcol (sspstat) shift clock msb lsb sda acknowledge generate stop bit detect write collision detect clock arbitration state counter for end of xmit/rcv scl scl in bus collision sda in receive enable clock cntl clock arbitrate/wcol detect (hold off clock source) sspadd<6:0> baud set sspif, bclif reset ackstat, pen (sspcon2) rate generator sspm<3:0>,
pic16c717/770/771 ds41120b-page 84 advance information ? 2002 microchip technology inc. 9.2.7 multi-master operation in multi-master mode, the interrupt generation on the detection of the start and stop conditions allows the determination of when the bus is free. the stop (p) and start (s) bits are cleared from a reset or when the mssp module is disabled. control of the i 2 c bus may be taken when bit p (sspstat<4>) is set, or the bus is idle with both the s and p bits clear. when the bus is busy, enabling the ssp interrupt will gener- ate the interrupt when the stop condition occurs. in multi-master operation, the sda line must be moni- tored for arbitration to see if the signal level is the expected output level. this check is performed in hard- ware, with the result placed in the bclif bit. the states where arbitration can be lost are:  address transfer  data transfer  a start condition  a repeated start condition  an acknowledge condition refer to application note an578, "use of the ssp module in the i 2 c ? multi-master environment." 9.2.8 i 2 c master operation master mode is enabled by setting and clearing the appropriate sspm bits in sspcon and by setting the sspen bit. once master mode is enabled, the user has six options. 1. assert a start condition on sda and scl. 2. assert a repeated start condition on sda and scl. 3. write to the sspbuf register initiating transmis- sion of data/address. 4. generate a stop condition on sda and scl. 5. configure the i 2 c port to receive data. 6. generate an acknowledge condition at the end of a received byte of data. the master device generates all serial clock pulses and the start and stop conditions. a transfer is ended with a stop condition or with a repeated start con- dition. since the repeated start condition is also the beginning of the next serial transfer, the i 2 c bus will not be released. 9.2.9 baud rate generator the baud rate generator used for spi mode operation is used in the i 2 c master mode to set the scl clock fre- quency. standard scl clock frequencies are 100 khz, 400 khz, and 1 mhz. one of these frequencies can be achieved by setting the sspadd register to the appro- priate number for the selected fosc frequency. one half of the scl period is equal to [(sspadd+1) ? 2]/fosc. the baud rate generator reload value is contained in the lower seven bits of the sspadd register (figure 9- 14). when the brg is loaded with this value, the brg counts down to 0 and stops until another reload occurs. the brg count is decremented twice per instruction cycle (t cy ) on the q2 and q4 clock. in i 2 c master mode, the brg is reloaded automatically provided that the scl line is sampled high. for exam- ple, if clock arbitration is taking place, the brg reload will be suppressed until the scl line is released by the slave allowing the pin to float high (figure 9-15). figure 9-14: baud rate generator block diagram note: the mssp module, when configured in i 2 c master mode, does not allow queueing of events. for instance, the user is not allowed to initiate a start condition and immediately write the sspbuf register to initiate transmission before the start condition is complete. in this case, the sspbuf will not be written to, and the wcol bit will be set, indicating that a write to the sspbuf did not occur. sspm<3:0> brg down counter brg clkout fosc/2 sspadd<6:0> sspm<3:0> scl reload control reload
? 2002 microchip technology inc. advance information ds41120b-page 85 pic16c717/770/771 figure 9-15: baud rate generator timing with clock arbitration 9.2.10 i 2 c master mode start condition timing to initiate a start condition, the user sets the start condition enable bit, sen (sspcon2<0>). if the sda and scl pins are sampled high, indicating that the bus is available, the baud rate generator is loaded with the contents of sspadd<6:0> and starts its count. if scl and sda are both sampled high when the baud rate generator times out (t brg ) indicating the bus is still available, the sda pin is driven low. the sda transition from high to low while scl is high is the start condi- tion. this causes the s bit (sspstat<3>) to be set. when the s bit is set, the baud rate generator is reloaded with the contents of sspadd<6:0> and resumes its count. when the baud rate generator times out (t brg ) the start condition is complete, concur- rent with the following events:  the sen bit (sspcon2<0>) is automatically cleared by hardware,  the baud rate generator is suspended leaving the sda line held low.  the sspif flag is set. 9.2.10.1 wcol status flag if the user writes the sspbuf when a start sequence is in progress, the wcol is set and the con- tents of the buffer are unchanged (the write doesn ? t occur). figure 9-16: first start bit timing sda scl scl de-asserted but slave holds dx-1 dx brg scl is sampled high, reload takes place, and brg starts its count. 03h 02h 01h 00h (hold off) 03h 02h reload brg value scl low (clock arbitration) scl allowed to transition high brg decrements (on q2 and q4 cycles) note: if at the beginning of start condition, the sda and scl pins are already sampled low, or if during the start condition, the scl line is sampled low before the sda line is driven low, a bus collision occurs. thus, the bus collision interrupt flag (bclif) is set, the start condition is aborted, and the i 2 c module is reset into its idle state. note: because queueing of events is not allowed, writing to the lower five bits of sspcon2 is disabled until the start condition is complete. sda scl s t brg 1st bit 2nd bit t brg sda = 1, at completion of start bit, scl = 1 write to sspbuf occurs here t brg hardware clears sen bit t brg write to sen bit occurs here. set s bit (sspstat<3>) and sets sspif bit
pic16c717/770/771 ds41120b-page 86 advance information ? 2002 microchip technology inc. 9.2.11 i 2 c master mode repeated start condition timing a repeated start condition occurs when the rsen bit (sspcon2<1>) is set high while the i 2 c module is in the idle state. when the rsen bit is set, the scl pin is asserted low. when the scl pin is sampled low, the baud rate generator is loaded with the contents of sspadd<6:0> and begins counting. the sda pin is released (brought high) for one baud rate generator count (t brg ). when the baud rate generator times out, if sda is sampled high, the scl pin will be de-asserted (brought high). when scl is sampled high, the baud rate generator is reloaded with the contents of sspadd<6:0> and begins counting. sda and scl must be sampled high for one t brg period. this action is then followed by assertion of the sda pin (sda is low) for one t brg period while scl is high. as soon as a start condition is detected on the sda and scl pins, the s bit (sspstat<3>) will be set. following this, the baud rate generator is reloaded with the con- tents of sspad<6:0> and begins counting. when the brg times out a third time, the rsen bit in the sspcon2 register is automatically cleared and scl is pulled low. the sspif flag is set, which indicates the restart sequence is complete. immediately following the sspif bit transition to true, the user may write the sspbuf with the 7-bit address in 7-bit mode, or the default first address in 10-bit mode. after the first eight bits are transmitted and an ack is received, the user may then perform one of the following:  transmit an additional eight bits of address (if the user transmitted the first half of a 10-bit address with r/w = 0),  transmit eight bits of data (if the user transmitted a 7-bit address with r/w = 0), or  receive eight bits of data (if the user transmitted either the first half of a 10-bit address or a 7-bit address with r/w = 1). 9.2.11.1 wcol status flag if the user writes the sspbuf when a repeated start sequence is in progress, then wcol is set and the contents of the buffer are unchanged (the write doesn ? t occur). figure 9-17: repeat start condition waveform note 1: if rsen is set while another event is in progress, it will not take effect. queuing of events is not allowed. 2: a bus collision during the repeated start condition occurs if either of the following is true: a) sda is sampled low when scl goes from low to high. b) scl goes low before sda is asserted low. this may indicate that another master is attempting to transmit a data ? 1 ? . note: because queueing of events is not allowed, writing of the lower five bits of sspcon2 is disabled until the repeated start condition is complete. sda scl sr = repeated start write to sspcon2 write to sspbuf occurs here. falling edge of ninth clock end of xmit at completion of start bit, hardware clears rsen bit 1st bit set s (sspstat<3>) t brg t brg sda = 1, sda = 1, scl (no change) scl = 1 occurs here. t brg t brg t brg and sets sspif
? 2002 microchip technology inc. advance information ds41120b-page 87 pic16c717/770/771 9.2.12 i 2 c master mode transmission in master-transmitter mode, serial data is output through sda, while scl outputs the serial clock. the first byte transmitted contains seven bits of address data and the read/write (r/w ) bit. in this case, the r/ w bit will be logic ? 0 ? . subsequent serial data is trans- mitted eight bits at a time. after each byte is transmit- ted, an acknowledge bit is received. start and stop conditions are output to indicate the beginning and the end of a serial transfer. transmission of a data byte, a 7-bit address, or either half of a 10-bit address is accomplished by simply writ- ing a value to the sspbuf register. this action will set the buffer full flag (bf) and allow the baud rate genera- tor to begin counting and start the next transmission. each bit of address/data will be shifted out onto the sda pin after the falling edge of scl is asserted (see data hold time spec). scl is held low for one baud rate generator roll over count (t brg ). data should be valid before scl is released high (see data setup time spec). when the scl pin is released high, it is held that way for t brg , the data on the sda pin must remain sta- ble for that duration and some hold time after the next falling edge of scl. after the eighth bit is shifted out (the falling edge of the eighth clock), the bf flag is cleared and the master releases sda. this allows the slave device being addressed to respond with an ack bit during the ninth bit time. the status of ack is read into the ackdt on the rising edge of the ninth clock. if the master receives an acknowledge, the acknowl- edge status bit (ackstat) is cleared. otherwise, the bit is set. the sspif is set on the falling edge of the ninth clock, and the master clock (baud rate generator) is suspended until the next data byte is loaded into the sspbuf leaving scl low and sda unchanged (figure 9-18). a typical transmit sequence would go as follows: a) the user generates a start condition by set- ting the start enable bit (sen) in sspcon2. b) sspif is set at the completion of the start sequence. c) the user resets the sspif bit and loads the sspbuf with seven bits of address plus r/w bit to transmit. d) address and r/w is shifted out the sda pin until all eight bits are transmitted. e) the mssp module shifts in the ack bit from the slave device, and writes its value into the sspcon2 register (sspcon2<6>). f) the module generates an interrupt at the end of the ninth clock cycle by setting sspif. g) the user resets the sspif bit and loads the sspbuf with eight bits of data. h) data is shifted out the sda pin until all eight bits are transmitted. i) the mssp module shifts in the ack bit from the slave device and writes its value into the sspcon2 register (sspcon2<6>). j) the mssp module generates an interrupt at the end of the ninth clock cycle by setting the sspif bit. k) the user resets the sspif bit and generates a stop condition by setting the stop enable bit pen in sspcon2. l) sspif is set when the stop condition is complete. 9.2.12.1 bf status flag in transmit mode, the bf bit (sspstat<0>) is set when the cpu writes to sspbuf and is cleared when all eight bits are shifted out. 9.2.12.2 wcol status flag if the user writes the sspbuf when a transmit is already in progress (i.e. sspsr is still shifting out a data byte), then wcol is set and the contents of the buffer are unchanged (the write doesn ? t occur). wcol must be cleared in software. 9.2.12.3 ackstat status flag in transmit mode, the ackstat bit (sspcon2<6>) is cleared when the slave has sent an acknowledge (ack = 0), and is set when the slave does not acknowl- edge (ack = 1). a slave sends an acknowledge when it has recognized its address (including a general call), or when the slave has properly received its data.
pic16c717/770/771 ds41120b-page 88 advance information ? 2002 microchip technology inc. figure 9-18: i 2 c master mode waveforms for transmission (7 or 10-bit address) sda scl sspif bf (sspstat<0>) sen a7 a6 a5 a4 a3 a2 a1 ack d7 d6 d5 d4 d3 d2 d1 d0 nack transmitting data or second half r/w = 0 transmit address to slave 123456789 123456789 p cleared in software service routine sspbuf is written in software from ssp interrupt after start condition sen cleared by hardware. s sspbuf written with 7-bit address and r/w start transmit scl held low sen = 0 of 10-bit address write sspcon2<0> sen = 1 start condition begins ack from slave clears ackstat bit (sspcon2<6>) cleared in software sspbuf written pen cleared in software pen is set to initiate stop condition nack from slave sets ackstat bit (sspcon2<6>) until sspbuf is written.
? 2002 microchip technology inc. advance information ds41120b-page 89 pic16c717/770/771 9.2.13 i 2 c master mode reception in master-receive mode, the first byte transmitted con- tains seven bits of address data and the r/w bit. in this case, the r/w bit will be logic ? 1 ? . thus, the first byte transmitted is a 7-bit slave address followed by a ? 1 ? to indicate receive. serial data is received via sda, while scl outputs the serial clock. serial data is received eight bits at a time. after each byte is received, an acknowledge bit is transmitted. the start condition indicates the beginning of a transmission. the master- receiver terminates slave transmission by responding to the last byte with a nack acknowledge and follows this with a stop condition to indicate to other masters that the bus is free. master mode reception is enabled by setting the receive enable bit, rcen (sspcon2<3>), immedi- ately following the acknowledge sequence. the baud rate generator begins counting, and on each rollover, the state of the scl pin changes (high to low/ low to high) and data is shifted into the sspsr. after the falling edge of the eighth clock, the following events occur:  the receive enable bit is automatically cleared.  the contents of the sspsr are loaded into the sspbuf.  the bf flag is set.  the sspif is set.  the baud rate generator is suspended from counting, holding scl low. the ssp is now in idle state, awaiting the next com- mand. when the buffer is read by the cpu, the bf flag is automatically cleared. the user can then send an acknowledge bit at the end of reception by clearing the ackdt bit (sspcon2<5>) and setting the acknowl- edge sequence enable bit, acken (sspcon2<4>). a typical receive sequence would go as follows: a) the user generates a start condition by set- ting the start enable bit (sen) in sspcon2. b) sspif is set at the completion of the start sequence. c) the user resets the sspif bit and loads the sspbuf with seven bits of address in the msbs and the lsb (r/w bit) set to '1' for receive. d) address and r/w is shifted out the sda pin until all eight bits are transmitted. e) the mssp module shifts in the ack bit from the slave device, and writes its value into the sspcon2 register (sspcon2<6>). f) the module generates an interrupt at the end of the ninth clock cycle by setting sspif. g) the user resets the sspif bit and sets the rcen bit to enable reception. h) data is shifted into the sda pin until all eight bits are received. i) the mssp module sets the sspif bit and clears the rcen bit at the falling edge of the eighth clock. j) the user resets the sspif bit and sets the ackdt bit to '0' (ack ), if another byte is antici- pated. otherwise, the ackdt bit is set to '1' (nack) to terminate reception. the user sets adken to start the acknowledge sequence. k) the mssp module sets the sspif bit at the completion of the acknowledge. l) if a nack was sent in step ( j), then the user pro- ceeds with step ( m). otherwise, reception con- tinues by repeating steps ( g) through ( j). m) the user generates a stop condition by setting the stop enable bit pen in sspcon2. n) sspif is set when the stop condition is complete. 9.2.13.1 bf status flag in receive operation, bf is set when an address or data byte is loaded into sspbuf from sspsr. it is cleared by hardware when sspbuf is read. 9.2.13.2 sspov status flag in receive operation, sspov is set when eight bits are received into the sspsr and the bf flag is already set from a previous reception. 9.2.13.3 wcol status flag if the user writes the sspbuf when a receive is already in progress (i.e., sspsr is still shifting in a data byte), then wcol is set and the contents of the buffer are unchanged (the write doesn ? t occur). note: the mssp module must be in an idle state before the rcen bit is set or the rcen bit will be disregarded.
pic16c717/770/771 ds41120b-page 90 advance information ? 2002 microchip technology inc. figure 9-19: i 2 c master waveforms for reception (7-bit address) p 9 8 7 6 5 d0 d1 d2 d3 d4 d5 d6 d7 s a7 a6 a5 a4 a3 a2 a1 sda scl 12 3 4 5 6 7 8 9 12 3 4 5 678 9 1234 bus master terminates transfer ack receiving data from slave receiving data from slave d0 d1 d2 d3 d4 d5 d6 d7 ack r/w = 1 transmit address to slave sspif bf master sends nack to write to sspcon2<0>, (sen = 1) write to sspbuf ack from slave master configured as a receiver by programming sspcon2<3>, (rcen = 1) pen bit = 1 written here data shifted in on falling edge of clk starts transmit sen = 0 (sspstat<0>) nack last bit is shifted into sspsr and contents are unloaded into sspbuf sspif occurs at end of receive sspif occurs at end ack from master sspif occurs at sspif occurs at end of acknowledge sequence sspif occurs at end of acknow- ledge sequence end of receive rcen cleared automatically rcen = 1 to start next receive and set acken (sspcon2<4>) = 1 to start ack acknowledge sequence set ackdt (sspcon2<5>) = 0 rcen cleared automatically acken begin start condition cleared in software sda = ackdt = 0 writing sspbuf causes bf to go high sspif occurs at end of transmit sspif occurs at end of start terminate slave transmission and set acken (sspcon2<4>) = 1 to start nack acknowledge sequence set ackdt (sspcon2<5>) = 1 of stop sequence sspbuf is read clearing bf flag acken bit is set to initiate acknowledge sequence acken is cleared by hardware bf clears automatically when the last bit is shifted out.
? 2002 microchip technology inc. advance information ds41120b-page 91 pic16c717/770/771 9.2.14 acknowledge sequence timing an acknowledge sequence is enabled by setting the acknowledge sequence enable bit, acken (sspcon2<4>). when this bit is set, the scl pin is pulled low and the contents of the acknowledge data bit ackdt (sspcon2<5>) is presented on the sda pin. if the user wishes to generate an acknowledge (ack ), then the ackdt bit should be cleared. otherwise, the user should set the ackdt bit (nack) before starting an acknowledge sequence. the baud rate generator is then loaded from sspadd<6:0> and counts for one rollover period (t brg ). the scl pin is then de-asserted (pulled high). when the scl pin is sampled high (clock arbitration), the baud rate generator is reloaded and counts for another t brg . at the completion of the t brg period, the following events occur (see figure 9-20):  the scl pin is pulled low.  the acken bit is automatically cleared.  the baud rate generator is turned off.  the mssp module goes into idle mode. 9.2.14.1 wcol status flag if the user writes the sspbuf when an acknowledge sequence is in progress, the wcol is set and the con- tents of the buffer are unchanged (the write doesn ? t occur). figure 9-20: acknowledge sequence waveform note: t brg = one baud rate generator period. sda scl sspif occurs at the acknowledge sequence starts here, write to sspcon2 acken automatically cleared cleared in t brg t brg end of receive ack 8 acken = 1, ackdt = 0 d0 9 sspif software sspif occurs at the end of acknowledge sequence cleared in software
pic16c717/770/771 ds41120b-page 92 advance information ? 2002 microchip technology inc. 9.2.15 stop condition timing the master asserts a stop condition on the sda and scl pins at the end of a receive/transmit by setting the stop sequence enable bit pen (sspcon2<2>). at the end of a receive/transmit plus acknowledge, the scl line is held low immediately following the falling edge of the ninth scl pulse. when the pen bit is set, the mas- ter will assert the sda line low. when the sda line is sampled low, the baud rate generator is loaded from sspadd<6:0> and counts down to 0. when the baud rate generator times out, the scl pin is brought high, the brg is reloaded and one t brg (baud rate genera- tor rollover count) later, the sda pin is de-asserted. the sda pin transition from low to high while scl is high is the stop condition and causes the p bit (ssp- stat<4>) to be set. following this the baud rage gen- erator is reloaded with the contents of sspadd<6:0> and resumes its count. when the baud rate generator times out (t brg ) the stop condition is complete and the pen bit is cleared and the sspif bit is set (figure 9-21). whenever the firmware decides to take control of the bus, it should first determine if the bus is busy by check- ing the s and p bits in the sspstat register. when the mssp module detects a start or stop condition the sspif flag is set. if the bus is busy (s bit is set), then the cpu can be configured to be interrupted when when the bus is free by enabling the sspif interrupt to detect the stop bit. 9.2.15.1 wcol status flag if the user writes the sspbuf when a stop sequence is in progress, then wcol is set and the contents of the buffer are unchanged (the write doesn ? t occur). figure 9-21: stop condition receive or transmit mode scl sda sda asserted low before rising edge of clock write to sspcon2 set pen falling edge of 9th clock scl brought high after t brg note: t brg = one baud rate generator period. t brg t brg p bit (sspstat<4>) is set t brg to setup stop condition. nack p t brg pen bit (sspcon2<2>) is cleared by hardware and the sspif bit is set
? 2002 microchip technology inc. advance information ds41120b-page 93 pic16c717/770/771 9.2.16 clock arbitration clock arbitration occurs when the master, during any receive, transmit or repeated start/stop condition, de-asserts the scl pin (scl allowed to float high). when the scl pin is allowed to float high, the baud rate generator (brg) is suspended from counting until the scl pin is actually sampled high. when the scl pin is sampled high, the baud rate generator is reloaded with the contents of sspadd<6:0> and begins counting. this ensures that the scl high time will always be at least one brg rollover count in the event that the clock is held low by an external device (figure 9-22). figure 9-22: clock arbitration timing in master transmit mode scl sda brg overflow, release scl, if scl = 1 load brg with sspadd<6:0>, and start count brg overflow occurs, release scl, slave device holds scl low. scl = 1 brg starts counting clock high interval. scl line sampled once every machine cycle (tosc ? 4). hold off brg until scl is sampled high. t brg t brg t brg to measure high time interval
pic16c717/770/771 ds41120b-page 94 advance information ? 2002 microchip technology inc. 9.2.17 multi -master communication, bus collision, and bus arbitration multi-master mode support is achieved by bus arbitra- tion. when the master outputs address/data bits onto the sda pin, bus arbitration is initiated when one mas- ter outputs a ? 1 ? on sda (by letting sda float high) and another master asserts a ? 0 ? . if the expected data on sda is a ? 1 ? and the data sampled on the sda pin = ? 0 ? , then a bus collision has taken place. the master that expected a ? 1 ? will set the bus collision interrupt flag, bclif, and reset the i 2 c port to its idle state. (figure 9-23). a bus collision during transmit results in the following events:  the transmission is halted.  the bf flag is cleared  the sda and scl lines are de-asserted  the restriction on writing to the sspbuf during transmission is lifted. when the user services the bus collision interrupt ser- vice routine, and if the i 2 c bus is free, the user can resume communication by asserting a start condi- tion. a bus collision during a start, repeated start, stop or acknowledge condition results in the following events:  the condition is aborted.  the sda and scl lines are de-asserted.  the respective control bits in the sspcon2 regis- ter are cleared. when the user services the bus collision interrupt ser- vice routine, and if the i 2 c bus is free, the user can resume communication by asserting a start condi- tion. the master will continue to monitor the sda and scl pins, and if a stop condition occurs, the sspif bit will be set. a write to the sspbuf will start the transmission of data at the first data bit, regardless of where the trans- mitter left off when bus collision occurred. in multi-master mode, the interrupt generation on the detection of start and stop conditions allows the determination of when the bus is free. control of the i 2 c bus can be taken when the p bit is set in the sspstat register, or the bus is idle and the s and p bits are cleared. figure 9-23: bus collision timing for transmit and acknowledge sda scl bclif sda released sda line pulled low by another source sample sda. while scl is high data doesn ? t match what is driven bus collision has occurred. set bus collision interrupt. by the master. by master data changes while scl = 0
? 2002 microchip technology inc. advance information ds41120b-page 95 pic16c717/770/771 9.2.17.1 bus collision during a start condition during a start condition, a bus collision occurs if: a) sda or scl are sampled low at the beginning of the start condition (figure 9-24). b) scl is sampled low before sda is asserted low. (figure 9-25). during a start condition both the sda and the scl pins are monitored. if: the sda pin is already low or the scl pin is already low, then: the start condition is aborted, and the bclif flag is set, and the ssp module is reset to its idle state (figure 9-24). the start condition begins with the sda and scl pins de-asserted. when the sda pin is sampled high, the baud rate generator is loaded from sspadd<6:0> and counts down to 0. if the scl pin is sampled low while sda is high, a bus collision occurs, because it is assumed that another master is attempting to drive a data ? 1 ? during the start condition. if the sda pin is sampled low during this count, the brg is reset and the sda line is asserted early (figure 9-26). if however a ? 1 ? is sampled on the sda pin, the sda pin is asserted low at the end of the brg count. the baud rate generator is then reloaded and counts down to 0, and during this time, if the scl pin is sampled as ? 0 ? , a bus collision does not occur. at the end of the brg count the scl pin is asserted low. figure 9-24: bus collision during start condition (sda only) note: the reason that bus collision is not a factor during a start condition is that no two bus masters can assert a start condition at the exact same time. therefore, one master will always assert sda before the other. this condition does not cause a bus collision, because the two masters must be allowed to arbitrate the first address follow- ing the start condition. if the address is the same, arbitration must be allowed to continue into the data portion, repeated start or stop conditions. sda scl sen sda sampled low before sda goes low before the sen bit is set. s bit and sspif set because ssp module reset into idle state. sen cleared automatically because of bus collision. s bit and sspif set because set sen, enable start condition if sda = 1, scl=1 sda = 0, scl = 1 bclif s sspif sda = 0, scl = 1 sspif and bclif are cleared in software. sspif and bclif are cleared in software. set bclif, set bclif. start condition.
pic16c717/770/771 ds41120b-page 96 advance information ? 2002 microchip technology inc. figure 9-25: bus collision during start condition (scl = 0) figure 9-26: brg reset due to sda collision during start condition sda scl sen bus collision occurs, set bclif. scl = 0 before sda = 0, set sen, enable start sequence if sda = 1, scl = 1 t brg t brg sda = 0, scl = 1 bclif s sspif interrupts cleared in software. bus collision occurs, set bclif. scl = 0 before brg time out, ? 0 ? ? 0 ? ? 0 ? ? 0 ? sda scl sen set s set sen, enable start sequence if sda = 1, scl = 1 less than t brg t brg sda = 0, scl = 1 bclif s sspif s interrupts cleared in software. set sspif sda = 0, scl = 1 sda pulled low by other master. reset brg and assert sda scl pulled low after brg time-out set sspif ? 0 ?
? 2002 microchip technology inc. advance information ds41120b-page 97 pic16c717/770/771 9.2.17.2 bus collision during a repeated start condition during a repeated start condition, a bus collision occurs if: a) a low level is sampled on sda when scl goes from low level to high level. b) scl goes low before sda is asserted low, indi- cating that another master is attempting to trans- mit a data ? 1 ? . when the master module de-asserts sda and the pin is allowed to float high, the brg is loaded with sspadd<6:0>, and counts down to ? 0 ? . the scl pin is then de-asserted, and when sampled high, the sda pin is sampled. if sda is low, a bus collision has occurred (i.e., another master is attempting to transmit a data ? 0 ? ). if however sda is sampled high, then the brg is reloaded and begins counting. if sda goes from high to low before the brg times out, no bus collision occurs, because no two masters can assert sda at exactly the same time. if, however, scl goes from high to low before the brg times out and sda has not already been asserted, then a bus collision occurs. in this case, another master is attempting to transmit a data ? 1 ? during the repeated start condition. if at the end of the brg time-out both scl and sda are still high, the sda pin is driven low, the brg is reloaded, and begins counting. at the end of the count, regardless of the status of the scl pin, the scl pin is driven low and the repeated start condition is com- plete (figure 9-27). figure 9-27: bus collision during a repeated start condition (case 1) figure 9-28: bus collision during repeated start condition (case 2) sda scl rsen bclif s sspif sample sda when scl goes high. if sda = 0, set bclif and release sda and scl cleared in software ? 0 ? ? 0 ? ? 0 ? ? 0 ? sda scl bclif rsen s sspif interrupt cleared in software scl goes low before sda, set bclif. release sda and scl t brg t brg ? 0 ? ? 0 ? ? 0 ? ? 0 ?
pic16c717/770/771 ds41120b-page 98 advance information ? 2002 microchip technology inc. 9.2.17.3 bus collision during a stop condition bus collision occurs during a stop condition if: a) after the sda pin has been de-asserted and allowed to float high, sda is sampled low after the brg has timed out. b) after the scl pin is de-asserted, scl is sam- pled low before sda goes high. the stop condition begins with sda asserted low. when sda is sampled low, the scl pin is allowed to float. when the pin is sampled high (clock arbitration), the baud rate generator is loaded with sspadd<6:0> and counts down to ? 0 ? . after the brg times out sda is sampled. if sda is sampled low, a bus collision has occurred. this is due to another master attempting to drive a data '0' (figure 9-29). if the scl pin is sampled low before sda is allowed to float high, a bus collision occurs. this is another case of another master attempt- ing to drive a data '0' (figure 9-30). figure 9-29: bus collision during a stop condition (case 1) figure 9-30: bus collision during a stop condition (case 2) sda scl bclif pen p sspif t brg t brg t brg sda asserted low sda sampled low after t brg , set bclif ? 0 ? ? 0 ? ? 0 ? ? 0 ? sda scl bclif pen p sspif t brg t brg t brg assert sda scl goes low before sda goes high set bclif ? 0 ? ? 0 ?
? 2002 microchip technology inc. advance information ds41120b-page 99 pic16c717/770/771 9.2.18 connection considerations for i 2 c bus for standard mode i 2 c bus devices, the values of resistors r p and r s in figure 9-31 depends on the fol- lowing parameters  supply voltage  bus capacitance  number of connected devices (input current + leakage current). the supply voltage limits the minimum value of resistor r p due to the specified minimum sink current of 3 ma at v ol max = 0.4v for the specified output stages. for example, with a supply voltage of v dd = 5v+ 10% and v ol max = 0.4v at 3 ma, r p min = (5.5-0.4)/0.003 = 1.7 k ?. v dd as a function of r p is shown in figure 9-31. the desired noise margin of 0.1v dd for the low level limits the maximum value of r s . series resistors are optional and used to improve esd susceptibility. the bus capacitance is the total capacitance of wire, connections, and pins. this capacitance limits the max- imum value of r p due to the specified rise time (figure 9-31). the smp bit is the slew rate control enabled bit. this bit is in the sspstat register, and controls the slew rate of the i/o pins when in i 2 c mode (master or slave). figure 9-31: sample device configuration for i 2 c bus table 9-3: registers associated with i 2 c operation address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 por, bor mclr , wdt 0bh, 8bh, 10bh,18bh intcon gie peie t0ie inte rbie t0if intf rbif 0000 000x 0000 000u 0ch pir1 ? adif ? ? sspif ccp1if tmr2if tmr1if -0-- 0000 -0-- 0000 8ch pie1 ? adie ? ? sspie ccp1ie tmr2ie tmr1ie -0-- 0000 -0-- 0000 0dh pir2 lvdif ? ? ? bclif ? ? ccp2if 0--- 0--0 0--- 0--0 8dh pie2 lvdie ? ? ? bclie ? ? ccp2ie 0--- 0--0 0--- 0--0 13h sspbuf synchronous serial port receive buffer/transmit register xxxx xxxx uuuu uuuu 14h sspcon wcol sspov sspen ckp sspm3 sspm2 sspm1 sspm0 0000 0000 0000 0000 91h sspcon2 gcen ackstat ackdt acken rcen pen rsen sen 0000 0000 0000 0000 94h sspstat smp cke d/a psr/w ua bf 0000 0000 0000 0000 93h sspadd synchronous serial port (i 2 c mode) address register 0000 0000 0000 0000 legend: x = unknown, u = unchanged, - = unimplemented read as '0'. shaded cells are not used by the mssp in i 2 c mode. rp rp v dd + 10% sda scl note: i 2 c devices with input levels related to v dd must have one common supply line to which the pull-up resistor is also device cb=10 pf to 400 pf rs rs connected.
pic16c717/770/771 ds41120b-page 100 advance information ? 2002 microchip technology inc. notes:
? 2002 microchip technology inc. ds41120b-page 101 pic16c717/770/771 10.0 voltage reference module and low-voltage detect the voltage reference module provides reference voltages for the brown-out reset circuitry, the low-volt- age detect circuitry and the a/d converter. the source for the reference voltages comes from the bandgap reference circuit. the bandgap circuit is ener- gized anytime the reference voltage is required by the other sub-modules, and is powered down when not in use. the control registers for this module are lvdcon and refcon, as shown in register 10-1 and figure 10-2. register 10-1: low-voltage detect control register (lvdcon: 9ch) u-0 u-0 r-0 r/w-0 r/w-0 r/w-1 r/w-0 r/w-1 ? ? bgst lvden lv3 lv2 lv1 lv0 bit 7 bit 0 bit 7-6 unimplemented: read as '0' bit 5 bgst: bandgap stable status flag bit 1 = indicates that the bandgap voltage is stable, and lvd interrupt is reliable 0 = indicates that the bandgap voltage is not stable, and lvd interrupt should not be enabled bit 4 lvden: low-voltage detect power enable bit 1 = enables lvd, powers up bandgap circuit and reference generator 0 = disables lvd, powers down bandgap circuit if unused by bor or vrh/vrl bit 3-0 lv<3:0>: low voltage detection limit bits (1) 1111 = external analog input is used 1110 = 4.5v 1101 = 4.2v 1100 = 4.0v 1011 = 3.8v 1010 = 3.6v 1001 = 3.5v 1000 = 3.3v 0111 = 3.0v 0110 = 2.8v 0101 = 2.7v 0100 = 2.5v 0011 = reserved. do not use. 0010 = reserved. do not use. 0001 = reserved. do not use. 0000 = reserved. do not use. note: these are the minimum trip points for the lvd. see table 15-8 for the trip point tol- erances. selection of reserved setting may result in an inadvertent interrupt. legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
pic16c717/770/771 ds41120b-page 102 ? 2002 microchip technology inc. register 10-2: voltage reference control register (refcon: 9bh) r/w-0 r/w-0 r/w-0 r/w-0 u-0 u-0 u-0 u-0 vrhen vrlen vrhoen vrloen ? ? ? ? bit 7 bit 0 bit 7 vrhen: voltage reference high enable bit (vrh = 4.096v nominal) 1 = enabled, powers up reference generator 0 = disabled, powers down reference generator if unused by lvd, bor, or vrl bit 6 vrlen: voltage reference low enable bit (vrl = 2.048v nominal) 1 = enabled, powers up reference generator 0 = disabled, powers down reference generator if unused by lvd, bor, or vrh bit 5 vrhoen: high voltage reference output enable bit (1) 1 = enabled, vrh analog reference is output on ra3 if enabled (vrhen = 1) 0 = disabled, analog reference is used internally only (1) bit 4 vrloen: low voltage reference output enable bit 1 = enabled, vrl analog reference is output on ra2 if enabled (vrlen = 1) 0 = disabled, analog reference is used internally only bit 3-0 unimplemented: read as '0 ? note 1: ra2 and ra3 must be configured as analog inputs when the v ref output functions are enabled (see ansel on page 25). legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
? 2002 microchip technology inc. ds41120b-page 103 pic16c717/770/771 10.1 bandgap voltage reference the bandgap module generates a stable voltage refer- ence of over a range of temperatures and device sup- ply voltages. this module is enabled anytime any of the following are enabled:  brown-out reset  low-voltage detect  either of the internal analog references (vrh, vrl) whenever the above are all disabled, the bandgap module is disabled and draws no current. 10.2 internal v ref for a/d converter the bandgap output voltage is used to generate two stable references for the a/d converter module. these references are enabled in software to provide the user with the means to turn them on and off in order to min- imize current consumption. each reference can be indi- vidually enabled. the vrh reference is enabled with control bit vrhen (refcon<7>). when this bit is set, the gain amplifier is enabled. after a specified start-up time a stable ref- erence of 4.096v nominal is generated and can be used by the a/d converter as a reference input. the vrl reference is enabled by setting control bit vrlen (refcon<6>). when this bit is set, the gain amplifier is enabled. after a specified start-up time a stable reference of 2.048v nominal is generated and can be used by the a/d converter as a reference input. each voltage reference is available for external use via vrl and vrh pins. each reference, if enabled, can be output on an exter- nal pin by setting the vrhoen (high reference output enable) or vrloen (low reference output enable) con- trol bit. if the reference is not enabled, the vrhoen and vrloen bits will have no effect on the corre- sponding pin. the device specific pin can then be used as general purpose i/o. figure 10-1: block diagram of lvd and voltage reference circuit note: if vrh or vrl is enabled and the other ref- erence (vrl or vrh), the bor, and the lvd modules are not enabled, the band- gap will require a start-up time before the bandgap reference is stable. before using the internal vrh or vrl reference, ensure that the bandgap reference voltage is sta- ble by monitoring the bgst bit in the lvd- con register. the voltage references will not be reliable until the bandgap is stable as shown by bgst being set. v dd generates 16 to 1 mux bgap vrh vrl lvden lvdcon refcon boden lvden vrhen + vrlen ra1/an1/lvdin lvdif
pic16c717/770/771 ds41120b-page 104 ? 2002 microchip technology inc. 10.3 low voltage detect (lvd) this module is used to generate an interrupt when the supply voltage falls below a specified ? trip ? voltage. this module operates completely under software control. this allows a user to power the module on and off to periodically monitor the supply voltage, and thus minimize total current consumption. the lvd module is enabled by setting the lvden bit in the lvdcon register. the ? trip point ? voltage is the minimum supply voltage level at which the device can operate before the lvd module asserts an interrupt. when the supply voltage is equal to or less than the trip point, the module will generate an interrupt signal set- ting interrupt flag bit lvdif. if interrupt enable bit lvdie was set, then an interrupt is generated. the lvd inter- rupt can wake the device from sleep. the "trip point" voltage is software programmable to any one of 16 val- ues, five of which are reserved (see figure 10-1). the trip point is selected by programming the lv<3:0> bits (lvdcon<3:0>). once the lv bits have been programmed for the spec- ified trip voltage, the low-voltage detect circuitry is then enabled by setting the lvden (lvdcon<4>) bit. if the bandgap reference voltage is previously unused by either the brown-out circuitry or the voltage refer- ence circuitry, then the bandgap circuit requires a time to start-up and become stable before a low voltage con- dition can be reliably detected. the low-voltage inter- rupt flag is prevented from being set until the bandgap has reached a stable reference voltage. when the bandgap is stable the bgst (lvdcon<5>) bit is set indicating that the low-voltage interrupt flag bit is released to be set if v dd is equal to or less than the lvd trip point. 10.3.1 external analog voltage input the lvd module has an additional feature that allows the user to supply the trip voltage to the module from an external source. this mode is enabled when lv<3:0> = 1111 . when these bits are set the compar- ator input is multiplexed from an external input pin (ra1/an1/lvdin). note: the lvdif bit can not be cleared until the supply voltage rises above the lvd trip point. if interrupts are enabled, clear the lvdie bit once the first lvd interrupt occurs to prevent reentering the interrupt service routine immediately after exiting the isr.
? 2002 microchip technology inc. ds41120b-page 105 pic16c717/770/771 11.0 analog-to-digital converter (a/d) module the analog-to-digital (a/d) converter module has six inputs for the pic16c717/770/771. the pic16c717 analog-to-digital converter (a/d) allows conversion of an analog input signal to a corre- sponding 10-bit digital value, while the a/d converter in the pic16c770/771 allows conversion to a corre- sponding 12-bit digital value. the a/d module has up to 6 analog inputs, which are multiplexed into one sample and hold. the output of the sample and hold is the input into the converter, which generates the result via successive approximation. the analog reference voltages are software selectable to either the device ? s analog positive and negative supply voltages (av dd / av ss ), the voltage level on the v ref + and v ref - pins, or internal voltage references if enabled (vrh, vrl). the a/d converter can be triggered by setting the go/ done bit, or by the special event compare mode of the eccp module. when conversion is complete, the go/done bit returns to ? 0 ? , the adif bit in the pir1 register is set, and an a/d interrupt will occur, if enabled. the a/d converter has a unique feature of being able to operate while the device is in sleep mode. to oper- ate in sleep, the a/d conversion clock must be derived from the a/d ? s internal rc oscillator. the a/d module has four registers. these registers are:  a/d result register low adresl  a/d result register high adresh  a/d control register 0 (adcon0)  a/d control register 1 (adcon1) a device reset forces all registers to their reset state. this forces the a/d module to be turned off and any conversion is aborted. 11.1 control registers the adcon0 register, shown in register 11-1, con- trols the operation of the a/d module. the adcon1 register, shown in register 11-2, configures the func- tions of the port pins, the voltage reference configura- tion and the result format. the ansel register, shown in register 3-1, selects between the analog or digital port pin modes. the port pins can be configured as analog inputs or as digital i/o. the combination of the adresh and adresl regis- ters contain the result of the a/d conversion. the reg- ister pair is referred to as the adres register. when the a/d conversion is complete, the result is loaded into adres, the go/done bit (adcon0<2>) is cleared, and the a/d interrupt flag adif is set. the block diagram of the a/d module is shown in figure 11-3.
pic16c717/770/771 ds41120b-page 106 ? 2002 microchip technology inc. register 11-1: a/d control register 0 (adcon0: 1fh). r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 adcs1 adcs0 chs2 chs1 chs0 go/done chs3 adon bit 7 bit 0 bit 7-6 adcs<1:0>: a/d conversion clock select bits if internal vrl and/or vrh are not used for a/d reference (vcfg<2:0> = 000, 001, 011 or 101 ): 00 = f osc /2 01 = f osc /8 10 = f osc /32 11 = f rc (clock derived from a dedicated rc oscillator) if internal vrl and/or vrh are used for a/d reference (vcfg<2:0> = 010, 100, 110 or 111 ): 00 = f osc /16 01 = f osc /64 10 = f osc /256 11 = f rc /8 bit 5-3,1 chs:<3:0>: analog channel select bits 0000 = channel 00 (an0) 0001 = channel 01 (an1) 0010 = channel 02 (an2) 0011 = channel 03 (an3) 0100 = channel 04 (an4) 0101 = channel 05 (an5) 0110 = reserved, do not select 0111 = reserved, do not select 1000 = reserved, do not select 1001 = reserved, do not select 1010 = reserved, do not select 1011 = reserved, do not select 1100 = reserved, do not select 1101 = reserved, do not select 1110 = reserved, do not select 1111 = reserved, do not select bit 2 go/done : a/d conversion status bit 1 = a/d conversion cycle in progress. setting this bit starts an a/d conversion cycle. this bit is automatically cleared by hardware when the a/d conversion has completed. 0 = a/d conversion completed/not in progress bit 0 adon: a/d on bit 1 = a/d converter module is operating 0 = a/d converter is shutoff and consumes no operating current legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown
? 2002 microchip technology inc. ds41120b-page 107 pic16c717/770/771 register 11-2: a/d control register 1 (adcon1: 9fh) the value that is in the adresh and adresl regis- ters are not modified for a power-on reset. the adresh and adresl registers will contain unknown data after a power-on reset. the a/d conversion results can be left justified (adfm bit cleared), or right justified (adfm bit set). figure 11-1 through figure 11-2 show the a/d result data format of the pic16c717/770/771. figure 11-1: pic16c770/771 12-bit a/d result formats r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 adfm vcfg2 vcfg1 vcfg0 reserved reserved reserved reserved bit 7 bit 0 bit 7 adfm: a/d result format select bit 1 = right justified 0 = left justified bit 6-4 vcfg<2:0>: voltage reference configuration bits bit 3-0 reserved: do not use. note 1: this parameter is v dd for the pic16c717. 2: this parameter is v ss for the pic16c717. legend: r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? - n = value at por ? 1 ? = bit is set ? 0 ? = bit is cleared x = bit is unknown a/d v ref +a/d v ref - 000 av dd (1) av ss (2) 001 external v ref + external v ref - 010 internal vrh internal vrl 011 external v ref +av ss (2) 100 internal vrh av ss (2) 101 av dd (1) external v ref - 110 av dd (1) internal vrl 111 internal vrl av ss adresh (1eh) adresl (9eh) left justified (adfm = 0) msb lsb bit7 bit7 12-bit a/d result unused right justified (adfm = 1) msb lsb bit7 bit7 unused 12-bit a/d result
pic16c717/770/771 ds41120b-page 108 ? 2002 microchip technology inc. figure 11-2: pic16c717 10-bit a/d result format after the a/d module has been configured as desired, the selected channel must be acquired before the con- version is started. the analog input channels must have their corresponding tris and ansel bits selected as an input. to determine acquisition time, see section 11.6. after this acquisition time has elapsed, the a/d conversion can be started. the following steps should be followed for doing an a/d conversion: 11.2 configuring the a/d module 11.2.1 configuring analog port pins the ansel and tris registers control the operation of the a/d port pins. the port pins that are desired as analog inputs must have their corresponding tris bit set (input). if the tris bit is cleared (output), the digital output level (v oh or v ol ) will be converted. the proper ansel bits must be set (analog input) to disable the digital input buffer. the a/d operation is independent of the state of the tris bits and the ansel bits. 11.2.2 configuring the reference voltages the vcfg bits in the adcon1 register configure the a/d module reference inputs. the reference high input can come from an internal reference (vrh) or (vrl), an external reference (v ref +), or av dd . the low refer- ence input can come from an internal reference (vrl), an external reference (v ref -), or av ss . if an external reference is chosen for the reference high or reference low inputs, the port pin that multiplexes the incoming external references is configured as an analog input, regardless of the values contained in the a/d port con- figuration bits (pcfg<3:0>). (adfm = 0) msb lsb bit7 bit7 10-bit a/d result unused (adfm = 1) msb lsb bit7 bit7 unused 10-bit a/d result unused note 1: when reading the porta register, all pins configured as analog input channels will read as ? 0 ? . 2: when reading the portb register, all pins configured as analog pins on portb will be read as ? 1 ? . 3: analog levels on any pin that is defined as a digital input, including the anx pins, may cause the input buffer to consume current that is out of the devices specification.
? 2002 microchip technology inc. ds41120b-page 109 pic16c717/770/771 after the a/d module has been configured as desired and the analog input channels have their correspond- ing tris bits selected for port inputs, the selected channel must be acquired before conversion is started. the a/d conversion cycle can be initiated by setting the go/done bit. the a/d conversion begins and lasts for 13t ad . the following steps should be fol- lowed for performing an a/d conversion: 1. configure port pins:  configure analog input mode (ansel)  configure pin as input (trisa or trisb) 2. configure the a/d module  configure a/d result format / voltage refer- ence (adcon1)  select a/d input channel (adcon0)  select a/d conversion clock (adcon0)  turn on a/d module (adcon0) 3. configure a/d interrupt (if required)  clear adif bit  set adie bit  set peie bit  set gie bit 4. wait the required acquisition time. 5. start conversion  set go/done bit (adcon0) 6. wait 13t ad until a/d conversion is complete, by either:  polling for the go/done bit to be cleared or  waiting for the a/d interrupt 7. read a/d result registers (adresh and adresl), clear adif if required. 8. for next conversion, go to step 1, step 2 or step 3 as required. clearing the go/done bit during a conversion will abort the current conversion. the adresh and adresl registers will be updated with the partially completed a/d conversion value. that is, the adresh and adresl registers will contain the value of the current incomplete conversion. figure 11-3: a/d block diagram note: do not set the adon bit and the go/ done bit in the same instruction. doing so will cause the go/done bit to be automat- ically cleared. (i nput voltage ) v ain v ref + (r eference voltage +) av dd vcfg<2:0> chs<3:0> rb1/an5/s s rb0/an4/int ra3/an3/v ref +/vrh ra2/an2/v ref -/vrl ra1/an1 ra0/an0 a/d c onverter v ref - (r eference voltage -) av ss vcfg<2:0> vrh vrl vrl
pic16c717/770/771 ds41120b-page 110 ? 2002 microchip technology inc. 11.3 selecting the a/d conversion clock the a/d conversion cycle requires 13t ad : 1 t ad for set- tling time, and 12 t ad for conversion. the source of the a/d conversion clock is software selected. if neither the internal vrh nor vrl are used for the a/d converter, the four possible options for t ad are:  2 t osc  8 t osc  32 t osc  a/d rc oscillator if the vrh or vrl are used for the a/d converter refer- ence, then the t ad requirement is automatically increased by a factor of 8. for correct a/d conversions, the a/d conversion clock (t ad ) must be selected to ensure a minimum t ad time of 1.6 s. table 11-1 shows the resultant t ad times derived from the device operating frequencies and the a/d clock source selected. the adif bit is set on the rising edge of the 14th t ad . the go/done bit is cleared on the falling edge of the 14th t ad . table 11-1: t ad vs. device operating frequencies a/d reference source a/d clock source (t ad ) device frequency external v ref or analog supply operation adcs<1:0> 20 mhz 5 mhz 4 mhz 1.25 mhz 2 t osc 00 100 ns (2) 400 ns (2) 500 ns (2) 1.6 s 8 t osc 01 400 ns (2) 1.6 s2.0 s6.4 s 32 t osc 10 1.6 s6.4 s (3) 8.0 s (3) 25.6 s (3) a/d rc 11 2 - 6 s (1,4) 2 - 6 s (1,4) 2 - 6 s (1,4) 2 - 6 s (1,4) internal vrh or vrl 16 t osc 00 800 ns (2) 3.2 s (2) 4 s (2) 12.8 s 64 t osc 01 3.2 s (2) 12.8 s 16 s 51.2 s (3) 256 t osc 10 12.8 s51.2 s (3) 64 s (3) 204.8 s (3) a/d rc 11 16 - 48 s (4,5) 16 - 48 s (4,5) 16 - 48 s (4,5) 16 - 48 s (4,5) legend: shaded cells are outside of recommended range. note 1: the a/d rc source has a typical t ad time of 4 s for v dd > 3.0v. 2: these values violate the minimum required t ad time. 3: for faster conversion times, the selection of another clock source is recommended. 4: when the device frequency is greater than 1 mhz, the a/d rc clock source is only recommended if the conversion will be performed during sleep. 5: a/d rc clock source has a typical t ad time of 32 s for v dd > 3.0v.
? 2002 microchip technology inc. ds41120b-page 111 pic16c717/770/771 11.4 a/d conversions example 11-1 shows an example that performs an a/d conversion. the port pins are configured as analog inputs. the analog reference v ref + is the device av dd and the analog reference v ref - is the device av ss . the a/d interrupt is enabled and the a/d conversion clock is t rc . the conversion is performed on the an0 channel. example 11-1: performing an a/d conversion bsf status, rp0 ;select bank 1 clrf adcon1 ;configure a/d voltage reference movlw 0x01 movwf ansel ;disable an0 digital input buffer movwf trisa ;ra0 is input mode bsf pie1, adie ;enable a/d interrupt bcf status, rp0 ;select bank 0 movlw 0xc1 ;rc clock, a/d is on, ;ch 0 is selected movwf adcon0 ; bcf pir1, adif ;clear a/d int flag bsf intcon, peie ;enable peripheral bsf intcon, gie ;enable all interrupts ; ; ensure that the required sampling time for the ; selected input channel has lapsed. then the ; conversion may be started. bsf adcon0, go ;start a/d conversion : ;the adif bit will be ;set and the go/done bit : ;cleared upon completion- ;of the a/d conversion. ; wait for a/d completion and read adresh:adresl for result.
pic16c717/770/771 ds41120b-page 112 ? 2002 microchip technology inc. 11.5 a/d converter module operation figure 11-4 shows the flowchart of the a/d converter module. figure 11-4: flow chart of a/d operation sample adon = 0 adon = 0? go = 0? a/d clock go = 0 adif = 0 abort conversion sleep power-down a/d wake-up ye s no ye s no no ye s finish conversion go = 0 adif = 1 sleep no ye s finish conversion go = 0 adif = 1 stay in sleep selected channel = rc? instruction? sleep no ye s instruction? start of a/d conversion delayed 1 instruction cycle from sleep? power-down a/d ye s no finish conversion go = 0 adif = 1
? 2002 microchip technology inc. ds41120b-page 113 pic16c717/770/771 11.6 a/d sample requirements 11.6.1 recommended source impedance the maximum recommended impedance for ana- log sources is 2.5 k ? . this value is calculated based on the maximum leakage current of the input pin. the leakage current is 100 na max., and the analog input voltage cannot be varied by more than 1/4 lsb or 250 v due to leakage. this places a requirement on the input impedance of 250 v/100 na = 2.5 k ? . 11.6.2 sampling time calculation for the a/d converter to meet its specified accuracy, the charge holding capacitor (c hold ) must be allowed to fully charge to the input channel voltage level. the analog input model is shown in figure 11-5. the source impedance (r s ) and the internal sampling switch (r ss ) impedance directly affect the time required to charge the capacitor c hold . the sampling switch (r ss ) impedance varies over the device voltage (v dd ), see figure 11-5. the maximum recommended imped- ance for analog sources is 2.5 k ? . after the analog input channel is selected (changed) this sampling must be done before the conversion can be started. to calculate the minimum sampling time, equation 11- 2 may be used. this equation assumes that 1/4 lsb error is used (16384 steps for the a/d). the 1/4 lsb error is the maximum error allowed for the a/d to meet its specified resolution. the c hold is assumed to be 25 pf for the 12-bit a/d. example 11-2: a/d sampling time equation figure 11-3 shows the calculation of the minimum time required to charge c hold . this calculation is based on the following system assumptions: c hold = 25 pf r s = 2.5 k ? 1/4 lsb error v dd = 5v r ss = 10 k ? (worst case) temp (system max.) = 50 c note 1: the reference voltage (v ref ) has no effect on the equation, since it cancels itself out. 2: the charge holding capacitor (c hold ) is not discharged after each conversion. 3: the maximum recommended impedance for analog sources is 2.5 k ? . this is required to meet the pin leakage specifi- cation. v hold v ref v ref 16384 ---------------- ? = v ref v ref 16384 ---------------- ? v ref () 1 e t c ? c hold r ic r ss r s ++ () ------------------------------------------------------------------- ?? ?? ? ?? ?? ?? ?? ?? = v ref 1 1 16384 ---------------- ? ?? ?? v ref () 1 e t c ? c hold r ic r ss r s ++ () ------------------------------------------------------------------- ?? ?? ? ?? ?? ?? ?? ?? = t c c hold 1 kr ss r s ++ () 1 16384 ---------------- ?? ?? ln ? = solving for t c :
pic16c717/770/771 ds41120b-page 114 ? 2002 microchip technology inc. example 11-3: calculating the minimum required sample time figure 11-5: analog input model t acq = amplifier settling time + holding capacitor charging time +temperature offset ? t acq =5 s + t c + [(temp - 25 c)(0.05 s/ c)] ? t c = holding capacitor charging time t c =(c hold ) (r ic + r ss + r s ) in (1/16384) t c = -25 pf (1 k ? +10 k ? + 2.5 k ? ) in (1/16384) t c = -25 pf (13.5 k ? ) in (1/16384) t c = -0.338 (-9.704) s t c =3.3 s t acq =5 s + 3.3 s + [(50 c - 25 c)(0.05 s / c)] t acq = 8.3 s + 1.25 s t acq = 9.55 s ? the temperature coefficient is only required for temperatures > 25 c. c pin va r s port pin 5 pf v dd vt = 0.6v v t = 0.6v i leakage r ic ~ 1k sampling switch ss r ss c hold = 25 pf v ss 6v sampling switch (r ss ) 5v 4v 3v 2v 567891011 ( k ? ) v dd 100 na legend c pin v t i leakage r ic ss c hold = input capacitance = threshold voltage = leakage current at the pin due to = interconnect resistance = sampling switch = sample/hold capacitance various junctions ~
? 2002 microchip technology inc. ds41120b-page 115 pic16c717/770/771 11.7 use of the eccp trigger an a/d conversion can be started by the ? special event trigger ? of the ccp module. this requires that the ccp1m<3:0> bits be programmed as 1011b and that the a/d module is enabled (adon is set). when the trigger occurs, the go/done bit will be set on q2 to start the a/d conversion and the timer1 counter will be reset to zero. timer1 is reset to automatically repeat the a/d conversion cycle, with minimal soft- ware overhead (moving the adresh and adresl to the desired location). the appropriate analog input channel must be selected before the ? special event trigger ? sets the go/done bit (starts a conversion cycle). if the a/d module is not enabled (adon is cleared), then the ? special event trigger ? will be ignored by the a/d module, but will still reset the timer1 counter. 11.8 effects of a reset a device reset forces all registers to their reset state. this forces the a/d module to be turned off, and any conversion is aborted. the value that is in the adresh and adresl registers are not modified. the adresh and adresl registers will contain unknown data after a power-on reset. 11.9 faster conversion - lower resolution trade-off not all applications require a result with 12 bits of reso- lution, but may instead require a faster conversion time. the a/d module allows users to make the trade- off of conversion speed to resolution. regardless of the resolution required, the acquisition time is the same. to speed up the conversion, the a/d module may be halted by clearing the go/done bit after the desired number of bits in the result have been con- verted. once the go/done bit has been cleared, all of the remaining a/d result bits are ? 0 ? . the equation to determine the time before the go/done bit can be switched is as follows: conversion time = (n+1)t ad where: n = number of bits of resolution required, and 1t ad is the amplifier settling time. since t ad is based from the device oscillator, the user must use some method (a timer, software loop, etc.) to determine when the a/d go/done bit may be cleared. table 11-4 shows a comparison of time required for a conversion with 4 bits of resolution, ver- sus the normal 12-bit resolution conversion. the example is for devices operating at 20 mhz. the a/d clock is programmed for 32 t osc . example 11-4: 4-bit vs. 12-bit conversion time example 4-bit example: conversion time = (n + 1) t ad = (4 + 1) t ad = (5)(1.6 s) = 8 s 12-bit example: conversion time = (n + 1) t ad = (12 + 1) t ad = (13)(1.6 s) = 20.8 s
pic16c717/770/771 ds41120b-page 116 ? 2002 microchip technology inc. 11.10 a/d operation during sleep the a/d module can operate during sleep mode. this requires that the a/d clock source be configured for rc (adcs<1:0> = 11b ). with the rc clock source selected, when the go/done bit is set the a/d module waits one instruction cycle before starting the conver- sion cycle. this allows the sleep instruction to be exe- cuted, which eliminates all digital switching noise during the sample and conversion. when the conver- sion cycle is completed the go/done bit is cleared, and the result loaded into the adresh and adresl registers. if the a/d interrupt is enabled, the device will wake-up from sleep. if the a/d interrupt is not enabled, the a/d module will then be turned off, although the adon bit will remain set. when the a/d clock source is another clock option (not rc), a sleep instruction causes the present conver- sion to be aborted and the a/d module is turned off, though the adon bit will remain set. turning off the a/d places the a/d module in its lowest current consumption state. 11.11 connection considerations since the analog inputs employ esd protection, they have diodes to v dd and v ss . this requires that the analog input must be between v dd and v ss . if the input voltage exceeds this range by greater than 0.3v (either direction), one of the diodes becomes forward biased and it may damage the device if the input current spec- ification is exceeded. an external rc filter is sometimes added for anti-alias- ing of the input signal. the r component should be selected to ensure that the total source impedance is kept under the 2.5 k ? recommended specification. it is recommended that any external components con- nected to an analog input pin (capacitor, zener diode, etc.) have very little leakage current. table 11-2: summary of a/d registers note: for the a/d module to operate in sleep , the a/d clock source must be configured to rc (adcs<1:0> = 11 ). address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on: por, bor value on all other resets 0bh,8bh, 10bh,18bh intcon gie peie t0ie inte rbie t0if intf rbif 0000 000x 0000 000u 0ch pir1 ? adif ? ? sspif ccp1if tmr2if tmr1if -0-- 0000 -0-- 0000 8ch pie1 ? adie ? ? sspie ccp1ie tmr2ie tmr1ie -0-- 0000 -0-- 0000 1eh adresh a/d high byte result register xxxx xxxx uuuu uuuu 9eh adresl a/d low byte result register xxxx xxxx uuuu uuuu 9bh refcon vrhen vrlen vrhoen vrloen ? ? ? ? 0000 ---- 0000 ---- 1fh adcon0 adcs1 adcs0 chs2 chs1 chs0 go/done chs3 adon 0000 0000 0000 0000 9fh adcon1 adfm vcfg2 vcfg1 vcfg0 ? ? ? ? 0000 ---- 0000 ---- 05h porta porta data latch when written: porta pins when read 000x 0000 000u 0000 06h portb portb data latch when written: portb pins when read xxxx xx11 uuuu uu11 85h trisa porta data direction register 1111 1111 1111 1111 86h trisb portb data direction register 1111 1111 1111 1111 9dh ansel ? ? ans5 ans4 ans3 ans2 ans1 ans0 1111 1111 1111 1111 17h ccp1con ? ? ? ? 0000 0000 0000 0000 legend: x = unknown, u = unchanged, - = unimplemented read as ? 0 ? . shaded cells are not used for a/d conversion.
? 2002 microchip technology inc. ds41120b-page 117 pic16c717/770/771 12.0 special features of the cpu these devices have a host of features intended to max- imize system reliability, minimize cost through elimina- tion of external components, provide power saving operating modes and offer code protection. these are:  oscillator selection  reset - power-on reset (por) - power-up timer (pwrt) - oscillator start-up timer (ost) - brown-out reset (bor)  interrupts  watchdog timer (wdt)  low-voltage detection  sleep  code protection  id locations  in-circuit serial programming (icsp) these devices have a watchdog timer, which can be shut off only through configuration bits. it runs off its own rc oscillator for added reliability. there are two timers that offer necessary delays on power-up. one is the oscillator start-up timer (ost), intended to keep the chip in reset until the crystal oscillator is stable. the other is the power-up timer (pwrt), which pro- vides a fixed delay of 72 ms (nominal) on power-up type resets only (por, bor), designed to keep the part in reset while the power supply stabilizes. with these two timers on-chip, most applications need no external reset circuitry. sleep mode is designed to offer a very low current power-down mode. the user can wake-up from sleep through external reset, watchdog timer wake-up, or through an interrupt. several oscillator options are also made available to allow the part to fit the application. the intrc and er oscillator options save system cost while the lp crystal option saves power. a set of configuration bits are used to select var- ious options. additional information on special features is available in the picmicro ? mid-range mcu family reference manual, (ds33023). 12.1 configuration bits the configuration bits can be programmed (read as '0') or left unprogrammed (read as '1') to select various device configurations. these bits are mapped in pro- gram memory location 2007h. the user will note that address 2007h is beyond the user program memory space. some of the core features provided may not be neces- sary to each application that a device may be used for. the configuration word bits allow these features to be configured/enabled/disabled as necessary. these fea- tures include code protection, brown-out reset and its trip point, the power-up timer, the watchdog timer and the devices oscillator mode. as can be seen in register 12-1, some additional configuration word bits have been provided for brown-out reset trip point selection.
pic16c717/770/771 ds41120b-page 118 ? 2002 microchip technology inc. register 12-1: configuration word for 16c717/770/771 device cp cp borv1 borv0 cp cp ? boden mclre pwrte wdte fosc2 fosc1 fosc0 bit13 bit0 bit 13-12, 9-8 cp : program memory code protection 1 = code protection off 0 = all program memory is protected (2) bit 11-10: borv<1:0>: brown-out reset voltage bits 00 = v bor set to 4.5v 01 = v bor set to 4.2v 10 = v bor set to 2.7v 11 = v bor set to 2.5v bit 7: unimplemented: read as '1' bit 6: boden: brown-out detect reset enable bit (1) 1 = brown-out detect reset enabled 0 = brown-out detect reset disabled bit 5: mclre : ra5/mclr pin function select 1 = ra5/mclr pin function is mclr 0 = ra5/mclr pin function is digital input, mclr internally tied to v dd bit 4: pwrte : power-up timer enable bit (1) 1 = pwrt disabled 0 = pwrt enabled bit 3: wdte: watchdog timer enable bit 1 = wdt enabled 0 = wdt disabled bit 2-0: fosc<2:0>: oscillator selection bits 000 = lp oscillator: crystal/resonator on ra6/osc2/clkout and ra7/osc1/clkin 001 = xt oscillator: crystal/resonator on ra6/osc2/clkout and ra7/osc1/clkin 010 = hs oscillator: crystal/resonator on ra6/osc2/clkout and ra7/osc1/clkin 011 = ec: i/o function on ra6/osc2/clkout pin, clkin function on ra7/osc1/clkin 100 = intrc oscillator: i/o function on ra6/osc2/clkout pin, i/o function on ra7/osc1/clkin 101 = intrc oscillator: clkout function on ra6/osc2/clkout pin, i/o function on ra7/osc1/clkin 110 = er oscillator: i/o function on ra6/osc2/clkout pin, resistor on ra7/osc1/clkin 111 = er oscillator: clkout function on ra6/osc2/clkout pin, resistor on ra7/osc1/clkin note 1: enabling brown-out reset automatically enables the power-up timer (pwrt), regardless of the value of bit pwrte . ensure the power-up timer is enabled anytime brown-out reset is enabled. 2: all of the cp bits must be given the same value to enable code protection. legend r = readable bit w = writable bit u = unimplemented bit, read as ? 0 ? -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown
? 2002 microchip technology inc. ds41120b-page 119 pic16c717/770/771 12.2 oscillator configurations 12.2.1 oscillator types the pic16c717/770/771 can be operated in eight dif- ferent oscillator modes. the user can program three configuration bits (fosc<2:0>) to select one of these eight modes:  lp low power crystal  xt crystal/resonator  hs high speed crystal/resonator  er external resistor (with and without clkout)  intrc internal 4 mhz (with and without clkout)  ec external clock 12.2.2 lp, xt and hs modes in lp, xt or hs modes, a crystal or ceramic resonator is connected to the osc1/clkin and osc2/clkout pins to establish oscillation (figure 12-1). the pic16c717/770/771 oscillator design requires the use of a parallel cut crystal. use of a series cut crystal may give a frequency out of the crystal manufacturers spec- ifications. figure 12-1: crystal/ceramic resonator operation (hs, xt or lp osc configuration) table 12-1: ceramic resonators table 12-2: capacitor selection for crystal oscillator 12.2.3 ec mode in applications where the clock source is external, the pic16c717/770/771 should be programmed to select the ec (external clock) mode. in this mode, the ra6/ osc2/clkout pin is available as an i/o pin. see figure 12-2 for illustration. figure 12-2: external clock input operation (ec osc configuration) note1: see table 12-1 and table 12-2 for recom- mended values of c1 and c2. 2: a series resistor (rs) may be required for at strip cut crystals. 3: rf varies with the crystal mode chosen. c1(1) c2(1) xtal osc2 osc1 rf(3) sleep to logic pic16c717/770/771 rs(2) internal ranges tested: mode freq osc1 osc2 xt 455 khz 2.0 mhz 4.0 mhz 68 - 100 pf 15 - 68 pf 15 - 68 pf 68 - 100 pf 15 - 68 pf 15 - 68 pf hs 8.0 mhz 16.0 mhz 10 - 68 pf 10 - 22 pf 10 - 68 pf 10 - 22 pf these values are for design guidance only. see notes at bottom of page. all resonators used did not have built-in capacitors. osc type crystal freq cap. range c1 cap. range c2 lp 32 khz 33 pf 33 pf 200 khz 15 pf 15 pf xt 200 khz 47-68 pf 47-68 pf 1 mhz 15 pf 15 pf 4 mhz 15 pf 15 pf hs 4 mhz 15 pf 15 pf 8 mhz 15-33 pf 15-33 pf 20 mhz 15-33 pf 15-33 pf these values are for design guidance only. see notes at bottom of page. note 1: since each resonator/crystal has its own characteristics, the user should consult the resonator/crystal manufacturer for appropri- ate values of external components. 2: higher capacitance increases the stability of oscillator but also increases the start-up time. osc1 ra6 i/o clock from ext. system pic16c717/770/771
pic16c717/770/771 ds41120b-page 120 ? 2002 microchip technology inc. 12.2.4 er mode for timing insensitive applications, the er (external resistor) clock mode offers additional cost savings. only one external component, a resistor connected to the osc1 pin and v ss , is needed to set the operating frequency of the internal oscillator. the resistor draws a dc bias current which controls the oscillation fre- quency. in addition to the resistance value, the oscilla- tor frequency will vary from unit to unit, and as a function of supply voltage and temperature. since the controlling parameter is a dc current and not a capac- itance, the particular package type and lead frame will not have a significant effect on the resultant frequency. figure 12-3 shows how the controlling resistor is con- nected to the pic16c717/770/771. for r ext values below 38 k ? , the oscillator operation may become unstable, or stop completely. for very high r ext values (e.g. 1m), the oscillator becomes sensitive to noise, humidity and leakage. thus, we recommend keeping r ext between 38 k ? and 1 m ? . figure 12-3: external resistor the electrical specification section shows the relation- ship between the r ext resistance value and the oper- ating frequency as well as frequency variations due to operating temperature for given r ext and v dd values. the er oscillator mode has two options that control the osc2 pin. the first allows it to be used as a general purpose i/o port. the other configures the pin as clk- out. the er oscillator does not run during reset. 12.2.5 intrc mode the internal rc oscillator provides a fixed 4 mhz (nom- inal) system clock at v dd = 5v and 25 c, see ? electri- cal specifications ? section for information on variation over voltage and temperature. the intrc oscillator does not run during reset. 12.2.6 clkout in the intrc and er modes, the pic16c717/770/771 can be configured to provide a clock out signal by pro- gramming the configuration word. the oscillator fre- quency, divided by 4, can be used for test purposes or to synchronize other logic. in the intrc and er modes, if the clkout output is enabled, clkout is held low during reset. 12.2.7 dual speed operation for er and intrc modes a software programmable dual speed oscillator is avail- able in either er or intrc oscillator modes. this fea- ture allows the applications to dynamically toggle the oscillator speed between normal and slow frequencies. the nominal slow frequency is 37 khz. in er mode, the slow speed operation is fixed and does not vary with resistor size. applications that require low current power savings, but cannot tolerate putting the part into sleep, may use this mode. the oscf bit in the pcon register is used to control dual speed mode. see the pcon register, register 2-8, for details. when changing the intrc or er internal oscillator speed, there is a period of time when the processor is inactive. when the speed changes from fast to slow, the processor inactive period is in the range of 100 s to 300 s. for speed change from slow to fast, the pro- cessor is in active for 1.25 s to 3.25 s. ra7/osc1/clkin ra6/osc2/clkout pic16c717/770/771 r ext
? 2002 microchip technology inc. ds41120b-page 121 pic16c717/770/771 12.3 reset the pic16c717/770/771 devices have several differ- ent resets. these resets are grouped into two classifications; power-up and non-power-up. the power-up type resets are the power-on and brown- out resets which assume the device v dd was below its normal operating range for the device ? s configuration. the non power-up type resets assume normal oper- ating limits were maintained before/during and after the reset.  power-on reset (por)  programmable brown-out reset (pbor)  mclr reset during normal operation  mclr reset during sleep  wdt reset (during normal operation) some registers are not affected in any reset condi- tion. their status is unknown on a power-up reset and unchanged in any other reset. most other registers are placed into an initialized state upon reset, how- ever they are not affected by a wdt reset during sleep, because this is considered a wdt wake-up, which is viewed as the resumption of normal operation. several status bits have been provided to indicate which reset occurred (see table 12-4). see table 12-6 for a full description of reset states of all registers. a simplified block diagram of the on-chip reset circuit is shown in figure 12-4. these devices have a mclr noise filter in the mclr reset path. the filter will detect and ignore small pulses. it should be noted that a wdt reset does not drive mclr pin low. figure 12-4: simplified block diagram of on-chip reset circuit s r q external reset mclr v dd osc1 wdt module v dd rise detect ost/pwrt dedicated oscillator power-on reset ost 10-bit ripple counter pwrt chip_reset 10-bit ripple counter enable ost enable pwrt sleep brown-out programmable boden time-out
pic16c717/770/771 ds41120b-page 122 ? 2002 microchip technology inc. 12.4 power-on reset (por) a power-on reset pulse is generated on-chip when a v dd rise is detected (in the range of 1.5v - 2.1v). enable the internal m clr feature to eliminate external rc components usually needed to create a power-on reset. a maximum rise time for v dd is specified. see electrical specifications for details. for a long rise time, enable external mclr function and use circuit as shown in figure 12-5. two delay timers, (pwrt on ost), have been pro- vided which hold the device in reset after a por (dependent upon device configuration) so that all oper- ational parameters have been met prior to releasing the device to resume/begin normal operation. when the device starts normal operation (exits the reset condition), device operating parameters (volt- age, frequency, temperature,...) must be met to ensure operation. if these conditions are not met, the device must be held in reset until the operating conditions are met. brown-out reset may be used to meet the start-up conditions, or if necessary an external por cir- cuit may be implemented to delay end of reset for as long as needed. figure 12-5: external power-on reset circuit (for slow v dd ramp) 12.5 power-up timer (pwrt) the power-up timer provides a fixed t pwrt time-out on power-up type resets only. for a por, the pwrt is invoked when the por pulse is generated. for a bor, the pwrt is invoked when the device exits the reset condition (v dd rises above bor trip point). the power-up timer operates on an internal rc oscil- lator. the chip is kept in reset as long as the pwrt is active. the pwrt ? s time delay is designed to allow v dd to rise to an acceptable level. a configuration bit is provided to enable/disable the pwrt for the por only. for a bor the pwrt is always available regardless of the configuration bit setting. the power-up time delay will vary from chip-to-chip due to v dd , temperature and process variation. see dc parameters for details. 12.6 oscillator start-up timer (ost) the oscillator start-up timer (ost) provides 1024 oscillator cycle (from osc1 input) delay after the pwrt delay is over. this ensures that the crystal oscil- lator or resonator has started and stabilized. the ost time-out is invoked only for xt, lp and hs modes and only on a power-up type reset or a wake- up from sleep. 12.7 programmable brown-out reset (pbor) the programmable brown-out reset module is used to generate a reset when the supply voltage falls below a specified trip voltage. the trip voltage is configurable to any one of four voltages provided by the borv<1:0> configuration word bits. configuration bit, boden, can disable (if clear/pro- grammed) or enable (if set) the brown-out reset cir- cuitry. if v dd falls below the specified trip point for longer than t bor , (parameter #35), the brown-out situ- ation will reset the chip. a reset may not occur if v dd falls below the trip point for less than t bor . the chip will remain in brown-out reset until v dd rises above v bor . the power-up timer will be invoked at that point and will keep the chip in reset an additional t pwrt . if v dd drops below v bor while the power-up timer is running, the chip will go back into a brown-out reset and the power-up timer will be re-initialized. once v dd rises above v bor , the power-up timer will again begin a t pwrt time delay. even though the pwrt is always enabled when brown-out is enabled, the pwrt configuration word bit should be cleared (enabled) when brown-out is enabled. note 1: external power-on reset circuit is required only if v dd power-up slope is too slow. the diode d helps discharge the capacitor quickly when v dd powers down. 2: r < 40 k ? is recommended to make sure that voltage drop across r does not violate the device ? s electrical specification. 3: r1 = 100 ? to 1 k ? will limit any current flowing into mclr from external capacitor c in the event of mclr/ v pp pin break- down due to electrostatic discharge (esd) or electrical overstress (eos). 4: external mclr must be enabled (mclre = 1). c r1 r d v dd mclr pic16c717/770/771 v dd
? 2002 microchip technology inc. ds41120b-page 123 pic16c717/770/771 12.8 time-out sequence on power-up, the time-out sequence is as follows: first pwrt time-out is invoked by the por pulse. when the pwrt delay expires, the oscillator start-up timer is activated. the total time-out will vary based on oscillator configuration and the status of the pwrt. for example, in rc mode with the pwrt disabled, there will be no time-out at all. figure 12-6, figure 12- 7, figure 12-8 and figure 12-9 depict time-out sequences on power-up. since the time-outs occur from the por pulse, if mclr is kept low long enough, the time-outs will expire. then bringing mclr high will begin execution immediately (figure 12-8). this is useful for testing purposes or to synchronize more than one picmicro ? microcontroller operating in parallel. table 12-5 shows the reset conditions for some spe- cial function registers, while table 12-6 shows the reset conditions for all the registers. 12.9 power control/status register (pcon) the power control/status register, pcon, has two status bits that provide indication of which power-up type reset occurred. bit0 is brown-out reset status bit, bor . the bor bit is unknown upon a por. b or must be set by the user and checked on subsequent resets to see if bit bor cleared, indicating a bor occurred. bit1 is por (power-on reset status bit). it is cleared on a power-on reset and unaffected otherwise. the user must set this bit following a power-on reset. table 12-3: time-out in various situations table 12-4: status bits and their significance table 12-5: reset condition for special registers oscillator configuration power-up brown-out wake-up from sleep pwrte = 0 pwrte = 1 xt, hs, lp t pwrt + 1024t osc 1024t osc t pwrt + 1024t osc 1024t osc ec, er, intrc t pwrt ? t pwrt ? por bor to pd 0x11 power-on reset 0x0x illegal, to is set on por 0xx0 illegal, pd is set on por 1011 brown-out reset 1101 wdt reset 1100 wdt wake-up 11uu mclr reset during normal operation 1110 mclr reset during sleep or interrupt wake-up from sleep condition program counter status register pcon register power-on reset 000h 0001 1xxx ---- 1-0x mclr reset during normal operation 000h 000u uuuu ---- 1-uu mclr reset during sleep 000h 0001 0uuu ---- 1-uu wdt reset 000h 0000 1uuu ---- 1-uu wdt wake-up pc + 1 uuu0 0uuu ---- u-uu brown-out reset 000h 0001 1uuu ---- 1-u0 interrupt wake-up from sleep, gie = 0 pc + 1 uuu1 0uuu ---- u-uu interrupt wake-up from sleep, gie = 1 0004h uuu1 0uuu ---- u-uu legend: u = unchanged, x = unknown, - = unimplemented bit read as '0'.
pic16c717/770/771 ds41120b-page 124 ? 2002 microchip technology inc. table 12-6: initialization conditions for all registers register power-on reset or brown-out reset mclr reset or wdt reset wake-up via wdt or interrupt w xxxx xxxx uuuu uuuu uuuu uuuu indf 0000 0000 uuuu uuuu uuuu uuuu tmr0 xxxx xxxx uuuu uuuu uuuu uuuu pcl 0000h 0000h pc + 1 (1) status 0001 1xxx 000q quuu (2) uuuq quuu (2) fsr xxxx xxxx uuuu uuuu uuuu uuuu porta xxxx 0000 uuuu 0000 uuuu uuuu portb xxxx xx11 uuuu uu11 uuuu uuuu pclath ---0 0000 ---0 0000 ---u uuuu intcon 0000 000x 0000 000u uuuu uuqq pir1 -0-- 0000 -0-- 0000 -0-- uuuu pir2 0--- 0--- 0--- 0--- q--- q--- tmr1l xxxx xxxx uuuu uuuu uuuu uuuu tmr1h xxxx xxxx uuuu uuuu uuuu uuuu t1con --00 0000 --uu uuuu --uu uuuu tmr2 0000 0000 0000 0000 uuuu uuuu t2con -000 0000 -000 0000 -uuu uuuu sspbuf xxxx xxxx uuuu uuuu uuuu uuuu sspcon 0000 0000 0000 0000 uuuu uuuu ccpr1l xxxx xxxx uuuu uuuu uuuu uuuu ccpr1h xxxx xxxx uuuu uuuu uuuu uuuu ccp1con 0000 0000 0000 0000 uuuu uuuu adresh xxxx xxxx uuuu uuuu uuuu uuuu adcon0 0000 0000 0000 0000 uuuu uuuu option_reg 1111 1111 1111 1111 uuuu uuuu trisa 1111 1111 1111 1111 uuuu uuuu trisb 1111 1111 1111 1111 uuuu uuuu pie1 -0-- 0000 -0-- 0000 -u-- uuuu pie2 0--- 0--- 0--- 0--- u--- u--- pcon ---- 1-qq ---- 1-uu ---- u-uu pr2 1111 1111 1111 1111 1111 1111 sspadd 0000 0000 0000 0000 uuuu uuuu sspstat 0000 0000 0000 0000 uuuu uuuu wpub 1111 1111 1111 1111 uuuu uuuu iocb 1111 0000 1111 0000 uuuu uuuu legend: u = unchanged, x = unknown, - = unimplemented bit, read as ? 0 ? , q = value depends on condition note 1: when the wake-up is due to an interrupt and the gie bit is set, the pc is loaded with the interrupt vector (0004h). 2: see table 12-5 for reset value for specific condition.
? 2002 microchip technology inc. ds41120b-page 125 pic16c717/770/771 figure 12-6: time-out sequence on power-up (mclr tied to v dd ) p1del 0000 0000 0000 0000 uuuu uuuu refcon 0000 ---- 0000 ---- uuuu ---- lvdcon --00 0101 --00 0101 --uu uuuu ansel --11 1111 --11 1111 --uu uuuu adresl xxxx xxxx uuuu uuuu uuuu uuuu adcon1 0000 0000 0000 0000 uuuu uuuu pmdatl xxxx xxxx uuuu uuuu uuuu uuuu pmadrl xxxx xxxx uuuu uuuu uuuu uuuu pmdath --xx xxxx --uu uuuu --uu uuuu pmadrh ---- xxxx ---- uuuu ---- uuuu pmcon1 1--- ---0 1--- ---0 1--- ---0 table 12-6: initialization conditions for all registers (continued) register power-on reset or brown-out reset mclr reset or wdt reset wake-up via wdt or interrupt legend: u = unchanged, x = unknown, - = unimplemented bit, read as ? 0 ? , q = value depends on condition note 1: when the wake-up is due to an interrupt and the gie bit is set, the pc is loaded with the interrupt vector (0004h). 2: see table 12-5 for reset value for specific condition. t pwrt t ost v dd mclr internal por pwrt time-out ost time-out internal reset
pic16c717/770/771 ds41120b-page 126 ? 2002 microchip technology inc. figure 12-7: time-out sequence on power-up (mclr not tied to v dd ): case 1 figure 12-8: time-out sequence on power-up (mclr not tied to v dd ): case 2 figure 12-9: slow v dd rise time (mclr tied to v dd ) t pwrt t ost v dd mclr internal por pwrt time-out ost time-out internal reset v dd mclr internal por pwrt time-out ost time-out internal reset t pwrt t ost v dd mclr internal por pwrt time-out ost time-out internal reset 0v 5v t pwrt t ost note 1: time dependent on oscillator circuit (1)
? 2002 microchip technology inc. ds41120b-page 127 pic16c717/770/771 12.10 interrupts the devices have up to 11 sources of interrupt. the interrupt control register (intcon) records individual interrupt requests in flag bits. it also has individual and global interrupt enable bits. a global interrupt enable bit, gie (intcon<7>), enables (if set) all un-masked interrupts or disables (if cleared) all interrupts. when bit gie is enabled and an interrupt ? s flag bit and mask bit are set, the interrupt will vector immediately. individual interrupts can be dis- abled through their corresponding enable bits in vari- ous registers. individual interrupt bits are set, regardless of the status of the gie bit. the gie bit is cleared on reset. the ? return from interrupt ? instruction, retfie , exits the interrupt routine as well as sets the gie bit, which re-enables interrupts. the rb0/int pin interrupt, the rb port change interrupt and the tmr0 overflow interrupt flags are contained in the intcon register. the peripheral interrupt flags are contained in the spe- cial function registers pir1 and pir2. the correspond- ing interrupt enable bits are contained in special function registers pie1 and pie2, and the peripheral interrupt enable bit is contained in special function reg- ister intcon. when an interrupt is responded to, the gie bit is cleared to disable any further interrupt, the return address is pushed onto the stack and the pc is loaded with 0004h. once in the interrupt service routine the source(s) of the interrupt can be determined by polling the interrupt flag bits. the interrupt flag bit(s) must be cleared in software before re-enabling interrupts to avoid recursive interrupts. for external interrupt events, such as the int pin or portb change interrupt, the interrupt latency will be three or four instruction cycles. the exact latency depends when the interrupt event occurs. the latency is the same for one or two cycle instructions. individual interrupt flag bits are set regardless of the status of their corresponding mask bit or the gie bit figure 12-10: interrupt logic note: individual interrupt flag bits are set regard- less of the status of their corresponding mask bit or the gie bit. adif adie sspif sspie ccp1if ccp1ie tmr2if tmr2ie tmr1if tmr1ie t0if t0ie intf inte rbif rbie gie peie wake-up (if in sleep mode) interrupt to cpu lvdif lvdie bclie bclif
pic16c717/770/771 ds41120b-page 128 ? 2002 microchip technology inc. 12.10.1 int interrupt external interrupt on rb0/int pin is edge triggered: either rising if bit intedg (option_reg<6>) is set, or falling, if the intedg bit is clear. when a valid edge appears on the rb0/int pin, flag bit intf (intcon<1>) is set. this interrupt can be disabled by clearing enable bit inte (intcon<4>). flag bit intf must be cleared in software in the interrupt service rou- tine before re-enabling this interrupt. the int interrupt can wake-up the processor from sleep, if bit inte was set prior to going into sleep. the status of global inter- rupt enable bit gie decides whether or not the proces- sor branches to the interrupt vector following wake-up. see section 12.13 for details on sleep mode. 12.10.2 tmr0 interrupt an overflow (ffh 00h) in the tmr0 register will set flag bit t0if (intcon<2>). the interrupt can be enabled/disabled by setting/clearing enable bit t0ie (intcon<5>). (section 2.2.2.3) 12.10.3 portb intcon change an input change on portb<7:0> sets flag bit rbif (intcon<0>). the portb pin(s) which can individu- ally generate interrupt is selectable in the iocb regis- ter. the interrupt can be enabled/disabled by setting/ clearing enable bit rbie (intcon<4>). (section 2.2.2.3) 12.11 context saving during interrupts during an interrupt, only the pc is saved on the stack. at the very least, w and status should be saved to preserve the context for the interrupted program. all registers that may be corrupted by the isr, such as pclath or fsr, should be saved. example 12-1 stores and restores the status, w and pclath registers. the register, w_temp, is defined in common ram, the last 16 bytes of each bank that may be accessed from any bank. the status_temp and pclath_temp are defined in bank 0. the example: a) stores the w register. b) stores the status register in bank 0. c) stores the pclath register in bank 0. d) executes the isr code. e) restores the pclath register. f) restores the status register g) restores w. note that w_temp, status_temp and pclath_temp are defined in the common ram area (70h - 7fh) to avoid register bank switching during con- text save and restore. example 12-1: saving status, w, and pclath registers in ram #define w_temp 0x70 #define status_temp 0x71 #define pclath_temp 0x72 org 0x04 ; start at interrupt vector movwf w_temp ; save w register movf status,w movwf status_temp ; save status movf pclath,w movwf pclath_temp ; save pclath : (interrupt service routine) : movf pclath_temp,w movwf pclath movf status_temp,w movwf status swapf w_temp,f ; swapf w_temp,w ; swapf loads w without affecting status flags retfie
? 2002 microchip technology inc. ds41120b-page 129 pic16c717/770/771 12.12 watchdog timer (wdt) the watchdog timer is a free running on-chip rc oscil- lator, which does not require any external components. this oscillator is independent from the processor clock. if enabled, the wdt will run even if the main clock of the device has been stopped, for example, by execu- tion of a sleep instruction. during normal operation, a wdt time-out generates a device reset (watchdog timer reset). if the device is in sleep mode, a wdt time-out causes the device to wake-up and continue with normal operation (watch- dog timer wake-up). the to bit in the status regis- ter will be cleared upon a watchdog timer time-out. the wdt can be permanently disabled by program- ming the configuration bit wdte to ? 0 ? (section 12.1). wdt time-out period values may be found in table 15- 4. values for the wdt prescaler may be assigned using the option_reg register. figure 12-11: watchdog timer block diagram table 12-7: summary of watchdog timer registers note: the sleep instruction clears the wdt and the postscaler, if assigned to the wdt, restarting the wdt period. from tmr0 clock source ( figure 5-2 ) to t mr 0 ( figure 5-2 ) postscaler wdt timer wdt enable bit (2) 0 1 m u x psa 8 - to - 1 mux ps<2:0> (1) 0 1 mux psa (1) wdt time-out note 1: psa and ps<2:0> are bits in the option_reg register. 8 2: wdte bit in the configuration word. address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 2007h config. bits (1) ? boden mclre pwrte wdte fosc2 fosc1 fosc0 81h,181h option_reg rbpu intedg t0cs t0se psa ps2 ps1 ps0 legend: shaded cells are not used by the watchdog timer. note 1: see register 12-1 for the full description of the configuration word bits.
pic16c717/770/771 ds41120b-page 130 ? 2002 microchip technology inc. 12.13 power-down mode (sleep) power-down mode is entered by executing a sleep instruction. if enabled, the watchdog timer will be cleared but keeps running, the pd bit (status<3>) is cleared, the to (status<4>) bit is set, and the oscillator driver is turned off. the i/o ports maintain the status they had, before the sleep instruction was executed (driving high, low, or hi-impedance). for lowest current consumption in this mode, place all i/o pins at either v dd , or v ss , ensure no external cir- cuitry is drawing current from the i/o pin, power-down the a/d, disable external clocks. pull all i/o pins, that are hi-impedance inputs, high or low externally to avoid switching currents caused by floating inputs. the t0cki input should also be at v dd or v ss for lowest current consumption. the contribution from on-chip pull-ups on portb should be considered. 12.13.1 wake-up from sleep the device can wake-up from sleep through one of the following events: 1. external reset input on mclr pin. 2. watchdog timer wake-up (if wdt was enabled). 3. interrupt from int pin, rb port change, or some peripheral interrupts. external mclr reset will cause a device reset. all other events are considered a continuation of program execution and cause a "wake-up". the to and pd bits in the status register can be used to determine the cause of device reset. the pd bit, which is set on power-up, is cleared when sleep is invoked. the to bit is cleared if a wdt time-out occurred (and caused wake-up). the following peripheral interrupts can wake the device from sleep: 1. tmr1 interrupt. timer1 must be operating as an asynchronous counter. 2. ccp capture mode interrupt. 3. special event trigger (timer1 in asynchronous mode using an external clock). 4. ssp (start/stop) bit detect interrupt. 5. ssp transmit or receive in slave mode (spi/i 2 c). 6. a/d conversion (when a/d clock source is rc). 7. low voltage detect. other peripherals cannot generate interrupts since dur- ing sleep, no on-chip clocks are present. when the sleep instruction is being executed, the next instruction (pc + 1) is pre-fetched. for the device to wake-up through an interrupt event, the corresponding interrupt enable bit must be set (enabled). wake-up is regardless of the state of the gie bit. if the gie bit is clear (disabled), the device continues execution at the instruction after the sleep instruction. if the gie bit is set (enabled), the device executes the instruction after the sleep instruction and then branches to the inter- rupt address (0004h). in cases where the execution of the instruction following sleep is not desirable, the user should have a nop after the sleep instruction. 12.13.2 wake-up using interrupts when global interrupts are disabled (gie cleared) and any interrupt source has both its interrupt enable bit and interrupt flag bit set, one of the following will occur:  if the interrupt occurs before the execution of a sleep instruction, the sleep instruction will com- plete as a nop . therefore, the wdt and wdt postscaler will not be cleared, the to bit will not be set and pd bits will not be cleared.  if the interrupt occurs during or after the execu- tion of a sleep instruction, the device will imme- diately wake-up from sleep. the sleep instruction will be completely executed before the wake-up. therefore, the wdt and wdt postscaler will be cleared, the to bit will be set and the pd bit will be cleared. even if the flag bits were checked before executing a sleep instruction, it may be possible for flag bits to become set before the sleep instruction completes. to determine whether a sleep instruction executed, test the pd bit. if the pd bit is set, the sleep instruction was executed as a nop. if a peripheral can wake the device from sleep, then to ensure that the wdt is cleared, a clrwdt instruc- tion should be executed before a sleep instruction.
? 2002 microchip technology inc. ds41120b-page 131 pic16c717/770/771 figure 12-12: wake-up from sleep through interrupt 12.14 program verification/code protection if the code protection bit(s) have not been pro- grammed, the on-chip program memory can be read out for verification purposes. 12.15 id locations four memory locations (2000h - 2003h) are designated as id locations where the user can store checksum or other code-identification numbers. these locations are not accessible during normal execution but are read- able and writable during program/verify. it is recom- mended that only the 4 least significant bits of the id location are used. 12.16 in-circuit serial programming (icsp ? ) pic16cxxx microcontrollers can be serially pro- grammed while in the end application circuit. this is simply done with two lines for clock and data, and three other lines for power, ground, and the programming voltage. this allows customers to manufacture boards with unprogrammed devices, and then program the microcontroller just before shipping the product. this also allows the most recent firmware or a custom firm- ware to be programmed. for complete details of serial programming, please refer to the in-circuit serial programming (icsp ? ) guide, (ds30277). q1 q2 q3 q4 q1 q2 q3 q4 q1 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 osc1 clkout (3) int pin intf flag (intcon<1>) gie bit (intcon<7>) instruction flow pc instruction fetched instruction executed pc pc+1 pc+2 inst(pc) = sleep inst(pc - 1) inst(pc + 1) sleep processor in sleep interrupt latency (2) inst(pc + 2) inst(pc + 1) inst(0004h) inst(0005h) inst(0004h) dummy cycle pc + 2 0004h 0005h dummy cycle t ost (1) pc+2 note 1: t ost = 1024t osc (drawing not to scale) this delay applies to lp, xt and hs modes only. 2: gie = ? 1 ? assumed. in this case after wake- up, the processor jumps to the interrupt routine. if gie = ? 0 ? , execution will continue in-line. 3: clkout is not available in these osc modes, but shown here for timing reference. note: microchip does not recommend code pro- tecting windowed devices. code protected devices are not reprogrammable.
pic16c717/770/771 ds41120b-page 132 ? 2002 microchip technology inc. notes:
? 2002 microchip technology inc. ds41120b-page 133 pic16c717/770/771 13.0 instruction set summary each pic16cxxx instruction is a 14-bit word divided into an opcode which specifies the instruction type and one or more operands which further specify the operation of the instruction. the pic16cxx instruction set summary in table 13-2 lists byte-oriented , bit-ori- ented , and literal and control operations. table 13-1 shows the opcode field descriptions. for byte-oriented instructions, ? f ? represents a file reg- ister designator and ? d ? represents a destination desig- nator. the file register designator specifies which file register is to be used by the instruction. the destination designator specifies where the result of the operation is to be placed. if ? d ? is zero, the result is placed in the w register. if ? d ? is one, the result is placed in the file register specified in the instruction. for bit-oriented instructions, ? b ? represents a bit field designator which selects the number of the bit affected by the operation, while ? f ? represents the number of the file in which the bit is located. for literal and control operations, ? k ? represents an eight or eleven bit constant or literal value. table 13-1: opcode field descriptions the instruction set is highly orthogonal and is grouped into three basic categories:  byte-oriented operations  bit-oriented operations  literal and control operations all instructions are executed within one single instruc- tion cycle, unless a conditional test is true or the pro- gram counter is changed as a result of an instruction. in this case, the execution takes two instruction cycles with the second cycle executed as a nop . one instruc- tion cycle consists of four oscillator periods. thus, for an oscillator frequency of 4 mhz, the normal instruction execution time is 1 s. if a conditional test is true or the program counter is changed as a result of an instruc- tion, the instruction execution time is 2 s. table 13-2 lists the instructions recognized by the mpasm ? assembler. figure 13-1 shows the general formats that the instruc- tions can have. all examples use the following format to represent a hexadecimal number: 0xhh where h signifies a hexadecimal digit. figure 13-1: general format for instructions a description of each instruction is available in the picmicro ? mid-range mcu family reference man- ual, (ds33023). field description f register file address (0x00 to 0x7f) w working register (accumulator) b bit address within an 8-bit file register k literal field, constant data or label xdon ? t care location (= 0 or 1) the assembler will generate code with x = 0. it is the recommended form of use for compatibility with all microchip software tools. d destination select; d = 0: store result in w, d = 1: store result in file register f. default is d = 1 pc program counter to time-out bit pd power-down bit note: to maintain upward compatibility with future pic16cxxx products, do not use the option and tris instructions. byte-oriented file register operations 13 8 7 6 0 d = 0 for destination w opcode d f (file #) d = 1 for destination f f = 7-bit file register address bit-oriented file register operations 13 10 9 7 6 0 opcode b (bit #) f (file #) b = 3-bit bit address f = 7-bit file register address literal and control operations 13 8 7 0 opcode k (literal) k = 8-bit immediate value 13 11 10 0 opcode k (literal) k = 11-bit immediate value general call and goto instructions only
pic16c717/770/771 ds41120b-page 134 ? 2002 microchip technology inc. table 13-2: pic16cxxx instruction set mnemonic, operands description cycles 14-bit opcode status affected notes msb lsb byte-oriented file register operations addwf andwf clrf clrw comf decf decfsz incf incfsz iorwf movf movwf nop rlf rrf subwf swapf xorwf f, d f, d f - f, d f, d f, d f, d f, d f, d f, d f - f, d f, d f, d f, d f, d add w and f and w with f clear f clear w complement f decrement f decrement f, skip if 0 increment f increment f, skip if 0 inclusive or w with f move f move w to f no operation rotate left f through carry rotate right f through carry subtract w from f swap nybbles in f exclusive or w with f 1 1 1 1 1 1 1(2) 1 1(2) 1 1 1 1 1 1 1 1 1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0111 0101 0001 0001 1001 0011 1011 1010 1111 0100 1000 0000 0000 1101 1100 0010 1110 0110 dfff dfff lfff 0000 dfff dfff dfff dfff dfff dfff dfff lfff 0xx0 dfff dfff dfff dfff dfff ffff ffff ffff 0011 ffff ffff ffff ffff ffff ffff ffff ffff 0000 ffff ffff ffff ffff ffff c,dc,z z z z z z z z z c c c,dc,z z 1,2 1,2 2 1,2 1,2 1,2,3 1,2 1,2,3 1,2 1,2 1,2 1,2 1,2 1,2 1,2 bit-oriented file register operations bcf bsf btfsc btfss f, b f, b f, b f, b bit clear f bit set f bit test f, skip if clear bit test f, skip if set 1 1 1 (2) 1 (2) 01 01 01 01 00bb 01bb 10bb 11bb bfff bfff bfff bfff ffff ffff ffff ffff 1,2 1,2 3 3 literal and control operations addlw andlw call clrwdt goto iorlw movlw retfie retlw return sleep sublw xorlw k k k - k k k - k - - k k add literal and w and literal with w call subroutine clear watchdog timer go to address inclusive or literal with w move literal to w return from interrupt return with literal in w return from subroutine go into standby mode subtract w from literal exclusive or literal with w 1 1 2 1 2 1 1 2 2 2 1 1 1 11 11 10 00 10 11 11 00 11 00 00 11 11 111x 1001 0kkk 0000 1kkk 1000 00xx 0000 01xx 0000 0000 110x 1010 kkkk kkkk kkkk 0110 kkkk kkkk kkkk 0000 kkkk 0000 0110 kkkk kkkk kkkk kkkk kkkk 0100 kkkk kkkk kkkk 1001 kkkk 1000 0011 kkkk kkkk c,dc,z z to , pd z to , pd c,dc,z z note 1: when an i/o register is modified as a function of itself ( e.g., movf portb, 1 ), the value used will be that value present on the pins themselves. for example, if the data latch is ? 1 ? for a pin configured as input and is driven low by an external device, the data will be written back with a ? 0 ? . 2: if this instruction is executed on the tmr0 register (and, where applicable, d = 1), the prescaler will be cleared if assigned to the timer0 module. 3: if program counter (pc) is modified or a conditional test is true, the instruction requires two cycles. the second cycle is executed as a nop .
? 2002 microchip technology inc. ds41120b-page 135 pic16c717/770/771 13.1 instruction descriptions addlw add literal and w syntax: [ label ] addlw k operands: 0 k 255 operation: (w) + k (w) status affected: c, dc, z description: the contents of the w register are added to the eight bit literal ? k ? and the result is placed in the w register. addwf add w and f syntax: [ label ] addwf f,d operands: 0 f 127 d [0,1] operation: (w) + (f) (destination) status affected: c, dc, z description: add the contents of the w register with register ? f ? . if ? d ? is 0, the result is stored in the w register. if ? d ? is 1, the result is stored back in reg- ister ? f ? . andlw and literal with w syntax: [ label ] andlw k operands: 0 k 255 operation: (w) .and. (k) (w) status affected: z description: the contents of w register are and ? ed with the eight bit literal 'k'. the result is placed in the w register. andwf and w with f syntax: [ label ] andwf f,d operands: 0 f 127 d [0,1] operation: (w) .and. (f) (destination) status affected: z description: and the w register with register 'f'. if 'd' is 0, the result is stored in the w register. if 'd' is 1, the result is stored back in register 'f'. bcf bit clear f syntax: [ label ] bcf f,b operands: 0 f 127 0 b 7 operation: 0 (f) status affected: none description: bit 'b' in register 'f' is cleared. bsf bit set f syntax: [ label ] bsf f,b operands: 0 f 127 0 b 7 operation: 1 (f) status affected: none description: bit 'b' in register 'f' is set.
pic16c717/770/771 ds41120b-page 136 ? 2002 microchip technology inc. btfss bit test f, skip if set syntax: [ label ] btfss f,b operands: 0 f 127 0 b < 7 operation: skip if (f) = 1 status affected: none description: if bit ? b ? in register ? f ? is ? 0 ? , the next instruction is executed. if bit ? b ? is ? 1 ? , then the next instruc- tion is discarded and a nop is exe- cuted instead making this a 2t cy instruction. btfsc bit test, skip if clear syntax: [ label ] btfsc f,b operands: 0 f 127 0 b 7 operation: skip if (f) = 0 status affected: none description: if bit ? b ? in register ? f ? is ? 1 ? , the next instruction is executed. if bit ? b ? , in register ? f ? , is ? 0 ? , the next instruction is discarded, and a nop is executed instead, making this a 2t cy instruction. call call subroutine syntax: [ label ] call k operands: 0 k 2047 operation: (pc)+ 1 tos, k pc<10:0>, (pclath<4:3>) pc<12:11> status affected: none description: call subroutine. first, return address (pc+1) is pushed onto the stack. the eleven bit immedi- ate address is loaded into pc bits <10:0>. the upper bits of the pc are loaded from pclath. call is a two cycle instruction. clrf clear f syntax: [ label ] clrf f operands: 0 f 127 operation: 00h (f) 1 z status affected: z description: the contents of register ? f ? are cleared and the z bit is set. clrw clear w syntax: [ label ] clrw operands: none operation: 00h (w) 1 z status affected: z description: w register is cleared. zero bit (z) is set. clrwdt clear watchdog timer syntax: [ label ] clrwdt operands: none operation: 00h wdt 0 wdt prescaler, 1 to 1 pd status affected: to , pd description: clrwdt instruction resets the watchdog timer. it also resets the prescaler of the wdt. status bits to and pd are set.
? 2002 microchip technology inc. ds41120b-page 137 pic16c717/770/771 comf complement f syntax: [ label ] comf f,d operands: 0 f 127 d [0,1] operation: (f ) (destination) status affected: z description: the contents of register ? f ? are complemented. if ? d ? is 0, the result is stored in w. if ? d ? is 1, the result is stored back in register ? f ? . decf decrement f syntax: [ label ] decf f,d operands: 0 f 127 d [0,1] operation: (f) - 1 (destination) status affected: z description: decrement register ? f ? . if ? d ? is 0, the result is stored in the w regis- ter. if ? d ? is 1, the result is stored back in register ? f ? . decfsz decrement f, skip if 0 syntax: [ label ] decfsz f,d operands: 0 f 127 d [0,1] operation: (f) - 1 (destination); skip if result = 0 status affected: none description: the contents of register ? f ? are decremented. if ? d ? is 0, the result is placed in the w register. if ? d ? is 1, the result is placed back in reg- ister ? f ? . if the result is 1, the next instruc- tion is executed. if the result is 0, then a nop is executed instead making it a 2t cy instruction. goto unconditional branch syntax: [ label ] goto k operands: 0 k 2047 operation: k pc<10:0> pclath<4:3> pc<12:11> status affected: none description: goto is an unconditional branch. the eleven bit immediate value is loaded into pc bits <10:0>. the upper bits of pc are loaded from pclath<4:3>. goto is a two cycle instruction. incf increment f syntax: [ label ] incf f,d operands: 0 f 127 d [0,1] operation: (f) + 1 (destination) status affected: z description: the contents of register ? f ? are incremented. if ? d ? is 0, the result is placed in the w register. if ? d ? is 1, the result is placed back in reg- ister ? f ? . incfsz increment f, skip if 0 syntax: [ label ] incfsz f,d operands: 0 f 127 d [0,1] operation: (f) + 1 (destination), skip if result = 0 status affected: none description: the contents of register ? f ? are incremented. if ? d ? is 0, the result is placed in the w register. if ? d ? is 1, the result is placed back in regis- ter ? f ? . i f the result is 1, the next instruc- tion is executed. if the result is 0, a nop is executed instead making it a 2t cy instruction.
pic16c717/770/771 ds41120b-page 138 ? 2002 microchip technology inc. iorlw inclusive or literal with w syntax: [ label ] iorlw k operands: 0 k 255 operation: (w) .or. k (w) status affected: z description: the contents of the w register are or ? ed with the eight bit literal 'k'. the result is placed in the w reg- ister. iorwf inclusive or w with f syntax: [ label ] iorwf f,d operands: 0 f 127 d [0,1] operation: (w) .or. (f) (destination) status affected: z description: inclusive or the w register with register 'f'. if 'd' is 0 the result is placed in the w register. if 'd' is 1 the result is placed back in regis- ter 'f'. movf move f syntax: [ label ] movf f,d operands: 0 f 127 d [0,1] operation: (f) (destination) status affected: z description: the contents of register f are moved to a destination dependant upon the status of d. if d = 0, des- tination is w register. if d = 1, the destination is file register f itself. d = 1 is useful to test a file register since status flag z is affected. movlw move literal to w syntax: [ label ] movlw k operands: 0 k 255 operation: k (w) status affected: none description: the eight bit literal 'k' is loaded into w register. the don ? t cares will assemble as 0 ? s. movwf move w to f syntax: [ label ] movwf f operands: 0 f 127 operation: (w) (f) status affected: none description: move data from w register to reg- ister 'f'. nop no operation syntax: [ label ] nop operands: none operation: no operation status affected: none description: no operation.
? 2002 microchip technology inc. ds41120b-page 139 pic16c717/770/771 retfie return from interrupt syntax: [ label ] retfie operands: none operation: tos pc, 1 gie status affected: none retlw return with literal in w syntax: [ label ] retlw k operands: 0 k 255 operation: k (w); tos pc status affected: none description: the w register is loaded with the eight bit literal ? k ? . the program counter is loaded from the top of the stack (the return address). this is a two cycle instruction. return return from subroutine syntax: [ label ] return operands: none operation: tos pc status affected: none description: return from subroutine. the stack is poped and the top of the stack (tos) is loaded into the program counter. this is a two cycle instruction. rlf rotate left f through carry syntax: [ label ] rlf f,d operands: 0 f 127 d [0,1] operation: see description below status affected: c description: the contents of register ? f ? are rotated one bit to the left through the carry flag. if ? d ? is 0, the result is placed in the w register. if ? d ? is 1, the result is stored back in register ? f ? . rrf rotate right f through carry syntax: [ label ] rrf f,d operands: 0 f 127 d [0,1] operation: see description below status affected: c description: the contents of register ? f ? are rotated one bit to the right through the carry flag. if ? d ? is 0, the result is placed in the w register. if ? d ? is 1, the result is placed back in reg- ister ? f ? . sleep syntax: [ label ] sleep operands: none operation: 00h wdt, 0 wdt prescaler, 1 to , 0 pd status affected: to , pd description: the power-down status bit, pd is cleared. time-out status bit, to is set. watchdog timer and its prescaler are cleared. the processor is put into sleep mode with the oscillator stopped. see section 12.8 for more details. register f c register f c
pic16c717/770/771 ds41120b-page 140 ? 2002 microchip technology inc. sublw subtract w from literal syntax: [ label ] sublw k operands: 0 k 255 operation: k - (w) ( w) status affected: c, dc, z description: the w register is subtracted (2 ? s complement method) from the eight bit literal 'k'. the result is placed in the w register. subwf subtract w from f syntax: [ label ] subwf f,d operands: 0 f 127 d [0,1] operation: (f) - (w) ( destination) status affected: c, dc, z description: subtract (2 ? s complement method) w register from register 'f'. if 'd' is 0, the result is stored in the w regis- ter. if 'd' is 1, the result is stored back in register 'f'. swapf swap nybbles in f syntax: [ label ] swapf f,d operands: 0 f 127 d [0,1] operation: (f<3:0>) (destination<7:4>), (f<7:4>) (destination<3:0>) status affected: none description: the upper and lower nybbles of register 'f' are exchanged. if 'd' is 0, the result is placed in w regis- ter. if 'd' is 1, the result is placed in register 'f'. xorlw exclusive or literal with w syntax: [ label ] xorlw k operands: 0 k 255 operation: (w) .xor. k ( w) status affected: z description: the contents of the w register are xor ? ed with the eight bit lit- eral 'k'. the result is placed in the w register. xorwf exclusive or w with f syntax: [ label ] xorwf f,d operands: 0 f 127 d [0,1] operation: (w) .xor. (f) ( destination) status affected: z description: exclusive or the contents of the w register with register 'f'. if 'd' is 0, the result is stored in the w register. if 'd' is 1, the result is stored back in register 'f'.
? 2002 microchip technology inc. ds41120b-page 141 pic16c717/770/771 14.0 development support the picmicro ? microcontrollers are supported with a full range of hardware and software development tools:  integrated development environment - mplab ? ide software  assemblers/compilers/linkers - mpasm tm assembler - mplab c17 and mplab c18 c compilers -mplink tm object linker/ mplib tm object librarian  simulators - mplab sim software simulator  emulators - mplab ice 2000 in-circuit emulator - icepic ? in-circuit emulator  in-circuit debugger - mplab icd  device programmers -pro mate ? ii universal device programmer - picstart ? plus entry-level development programmer  low cost demonstration boards - picdem tm 1 demonstration board - picdem 2 demonstration board - picdem 3 demonstration board - picdem 17 demonstration board -k ee l oq ? demonstration board 14.1 mplab integrated development environment software the mplab ide software brings an ease of software development previously unseen in the 8-bit microcon- troller market. the mplab ide is a windows ? -based application that contains:  an interface to debugging tools - simulator - programmer (sold separately) - emulator (sold separately) - in-circuit debugger (sold separately)  a full-featured editor  a project manager  customizable toolbar and key mapping  a status bar  on-line help the mplab ide allows you to:  edit your source files (either assembly or ? c ? )  one touch assemble (or compile) and download to picmicro emulator and simulator tools (auto- matically updates all project information)  debug using: - source files - absolute listing file - machine code the ability to use mplab ide with multiple debugging tools allows users to easily switch from the cost- effective simulator to a full-featured emulator with minimal retraining. 14.2 mpasm assembler the mpasm assembler is a full-featured universal macro assembler for all picmicro mcu ? s. the mpasm assembler has a command line interface and a windows shell. it can be used as a stand-alone application on a windows 3.x or greater system, or it can be used through mplab ide. the mpasm assem- bler generates relocatable object files for the mplink object linker, intel ? standard hex files, map files to detail memory usage and symbol reference, an abso- lute lst file that contains source lines and generated machine code, and a cod file for debugging. the mpasm assembler features include:  integration into mplab ide projects.  user-defined macros to streamline assembly code.  conditional assembly for multi-purpose source files.  directives that allow complete control over the assembly process. 14.3 mplab c17 and mplab c18 c compilers the mplab c17 and mplab c18 code development systems are complete ansi ? c ? compilers for microchip ? s pic17cxxx and pic18cxxx family of microcontrollers, respectively. these compilers provide powerful integration capabilities and ease of use not found with other compilers. for easier source level debugging, the compilers pro- vide symbol information that is compatible with the mplab ide memory display.
pic16c717/770/771 ds41120b-page 142 ? 2002 microchip technology inc. 14.4 mplink object linker/ mplib object librarian the mplink object linker combines relocatable objects created by the mpasm assembler and the mplab c17 and mplab c18 c compilers. it can also link relocatable objects from pre-compiled libraries, using directives from a linker script. the mplib object librarian is a librarian for pre- compiled code to be used with the mplink object linker. when a routine from a library is called from another source file, only the modules that contain that routine will be linked in with the application. this allows large libraries to be used efficiently in many different applications. the mplib object librarian manages the creation and modification of library files. the mplink object linker features include:  integration with mpasm assembler and mplab c17 and mplab c18 c compilers.  allows all memory areas to be defined as sections to provide link-time flexibility. the mplib object librarian features include:  easier linking because single libraries can be included instead of many smaller files.  helps keep code maintainable by grouping related modules together.  allows libraries to be created and modules to be added, listed, replaced, deleted or extracted. 14.5 mplab sim software simulator the mplab sim software simulator allows code devel- opment in a pc-hosted environment by simulating the picmicro series microcontrollers on an instruction level. on any given instruction, the data areas can be examined or modified and stimuli can be applied from a file, or user-defined key press, to any of the pins. the execution can be performed in single step, execute until break, or trace mode. the mplab sim simulator fully supports symbolic debug- ging using the mplab c17 and the mplab c18 c com- pilers and the mpasm assembler. the software simulator offers the flexibility to develop and debug code outside of the laboratory environment, making it an excellent multi- project software development tool. 14.6 mplab ice high performance universal in-circuit emulator with mplab ide the mplab ice universal in-circuit emulator is intended to provide the product development engineer with a complete microcontroller design tool set for picmicro microcontrollers (mcus). software control of the mplab ice in-circuit emulator is provided by the mplab integrated development environment (ide), which allows editing, building, downloading and source debugging from a single environment. the mplab ice 2000 is a full-featured emulator sys- tem with enhanced trace, trigger and data monitoring features. interchangeable processor modules allow the system to be easily reconfigured for emulation of differ- ent processors. the universal architecture of the mplab ice in-circuit emulator allows expansion to support new picmicro microcontrollers. the mplab ice in-circuit emulator system has been designed as a real-time emulation system, with advanced features that are generally found on more expensive development tools. the pc platform and microsoft ? windows environment were chosen to best make these features available to you, the end user. 14.7 icepic in-circuit emulator the icepic low cost, in-circuit emulator is a solution for the microchip technology pic16c5x, pic16c6x, pic16c7x and pic16cxxx families of 8-bit one- time-programmable (otp) microcontrollers. the mod- ular system can support different subsets of pic16c5x or pic16cxxx products through the use of inter- changeable personality modules, or daughter boards. the emulator is capable of emulating without target application circuitry being present.
? 2002 microchip technology inc. ds41120b-page 143 pic16c717/770/771 14.8 mplab icd in-circuit debugger microchip ? s in-circuit debugger, mplab icd, is a pow- erful, low cost, run-time development tool. this tool is based on the flash picmicro mcus and can be used to develop for this and other picmicro microcontrollers. the mplab icd utilizes the in-circuit debugging capa- bility built into the flash devices. this feature, along with microchip ? s in-circuit serial programming tm proto- col, offers cost-effective in-circuit flash debugging from the graphical user interface of the mplab integrated development environment. this enables a designer to develop and debug source code by watch- ing variables, single-stepping and setting break points. running at full speed enables testing hardware in real- time. 14.9 pro mate ii universal device programmer the pro mate ii universal device programmer is a full-featured programmer, capable of operating in stand-alone mode, as well as pc-hosted mode. the pro mate ii device programmer is ce compliant. the pro mate ii device programmer has program- mable v dd and v pp supplies, which allow it to verify programmed memory at v dd min and v dd max for max- imum reliability. it has an lcd display for instructions and error messages, keys to enter commands and a modular detachable socket assembly to support various package types. in stand-alone mode, the pro mate ii device programmer can read, verify, or program picmicro devices. it can also set code protection in this mode. 14.10 picstart plus entry level development programmer the picstart plus development programmer is an easy-to-use, low cost, prototype programmer. it con- nects to the pc via a com (rs-232) port. mplab integrated development environment software makes using the programmer simple and efficient. the picstart plus development programmer sup- ports all picmicro devices with up to 40 pins. larger pin count devices, such as the pic16c92x and pic17c76x, may be supported with an adapter socket. the picstart plus development programmer is ce compliant. 14.11 picdem 1 low cost picmicro demonstration board the picdem 1 demonstration board is a simple board which demonstrates the capabilities of several of microchip ? s microcontrollers. the microcontrollers sup- ported are: pic16c5x (pic16c54 to pic16c58a), pic16c61, pic16c62x, pic16c71, pic16c8x, pic17c42, pic17c43 and pic17c44. all necessary hardware and software is included to run basic demo programs. the user can program the sample microcon- trollers provided with the picdem 1 demonstration board on a pro mate ii device programmer, or a picstart plus development programmer, and easily test firmware. the user can also connect the picdem 1 demonstration board to the mplab ice in- circuit emulator and download the firmware to the emu- lator for testing. a prototype area is available for the user to build some additional hardware and connect it to the microcontroller socket(s). some of the features include an rs-232 interface, a potentiometer for simu- lated analog input, push button switches and eight leds connected to portb. 14.12 picdem 2 low cost pic16cxx demonstration board the picdem 2 demonstration board is a simple dem- onstration board that supports the pic16c62, pic16c64, pic16c65, pic16c73 and pic16c74 microcontrollers. all the necessary hardware and soft- ware is included to run the basic demonstration pro- grams. the user can program the sample microcontrollers provided with the picdem 2 demon- stration board on a pro mate ii device programmer, or a picstart plus development programmer, and easily test firmware. the mplab ice in-circuit emula- tor may also be used with the picdem 2 demonstration board to test firmware. a prototype area has been pro- vided to the user for adding additional hardware and connecting it to the microcontroller socket(s). some of the features include a rs-232 interface, push button switches, a potentiometer for simulated analog input, a serial eeprom to demonstrate usage of the i 2 c tm bus and separate headers for connection to an lcd module and a keypad.
pic16c717/770/771 ds41120b-page 144 ? 2002 microchip technology inc. 14.13 picdem 3 low cost pic16cxxx demonstration board the picdem 3 demonstration board is a simple dem- onstration board that supports the pic16c923 and pic16c924 in the plcc package. it will also support future 44-pin plcc microcontrollers with an lcd mod- ule. all the necessary hardware and software is included to run the basic demonstration programs. the user can program the sample microcontrollers pro- vided with the picdem 3 demonstration board on a pro mate ii device programmer, or a picstart plus development programmer with an adapter socket, and easily test firmware. the mplab ice in-circuit emula- tor may also be used with the picdem 3 demonstration board to test firmware. a prototype area has been pro- vided to the user for adding hardware and connecting it to the microcontroller socket(s). some of the features include a rs-232 interface, push button switches, a potentiometer for simulated analog input, a thermistor and separate headers for connection to an external lcd module and a keypad. also provided on the picdem 3 demonstration board is a lcd panel, with 4 commons and 12 segments, that is capable of display- ing time, temperature and day of the week. the picdem 3 demonstration board provides an additional rs-232 interface and windows software for showing the demultiplexed lcd signals on a pc. a simple serial interface allows the user to construct a hardware demultiplexer for the lcd signals. 14.14 picdem 17 demonstration board the picdem 17 demonstration board is an evaluation board that demonstrates the capabilities of several microchip microcontrollers, including pic17c752, pic17c756a, pic17c762 and pic17c766. all neces- sary hardware is included to run basic demo programs, which are supplied on a 3.5-inch disk. a programmed sample is included and the user may erase it and program it with the other sample programs using the pro mate ii device programmer, or the picstart plus development programmer, and easily debug and test the sample code. in addition, the picdem 17 dem- onstration board supports downloading of programs to and executing out of external flash memory on board. the picdem 17 demonstration board is also usable with the mplab ice in-circuit emulator, or the picmaster emulator and all of the sample programs can be run and modified using either emulator. addition- ally, a generous prototype area is available for user hardware. 14.15 k ee l oq evaluation and programming tools k ee l oq evaluation and programming tools support microchip ? s hcs secure data products. the hcs eval- uation kit includes a lcd display to show changing codes, a decoder to decode transmissions and a pro- gramming interface to program test transmitters.
? 2002 microchip technology inc. ds41120b-page 145 pic16c717/770/771 table 14-1: development tools from microchip pic12cxxx pic14000 pic16c5x pic16c6x pic16cxxx pic16f62x pic16c7x pic16c7xx pic16c8x pic16f8xx pic16c9xx pic17c4x pic17c7xx pic18cxx2 pic18fxxx 24cxx/ 25cxx/ 93cxx hcsxxx mcrfxxx mcp2510 software tools mplab ? integrated development environment 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 mplab ? c17 c compiler 9 9 mplab ? c18 c compiler 9 9 mpasm tm assembler/ mplink tm object linker 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 emulators mplab ? ice in-circuit emulator 9 9 9 9 9 9 ** 9 9 9 9 9 9 9 9 9 icepic tm in-circuit emulator 9 9 9 9 9 9 9 9 debugger mplab ? icd in-circuit debugger 9 * 9 * 9 9 programmers picstart ? plus entry level development programmer 9 9 9 9 9 9 ** 9 9 9 9 9 9 9 9 9 pro mate ? ii universal device programmer 9 9 9 9 9 9 ** 9 9 9 9 9 9 9 9 9 9 9 demo boards and eval kits picdem tm 1 demonstration board 9 9 9 ? 9 9 picdem tm 2 demonstration board 9 ? 9 ? 9 9 picdem tm 3 demonstration board 9 picdem tm 14a demonstration board 9 picdem tm 17 demonstration board 9 k ee l oq ? evaluation kit 9 k ee l oq ? transponder kit 9 microid tm programmer ? s kit 9 125 khz microid tm developer ? s kit 9 125 khz anticollision microid tm developer ? s kit 9 13.56 mhz anticollision microid tm developer ? s kit 9 mcp2510 can developer ? s kit 9 * contact the microchip technology inc. web site at www.microchip.com for information on how to use the mplab ? icd in-circuit debugger (dv164001) with pic16c62, 63, 64, 65, 72, 73, 74, 76, 77. ** contact microchip technology inc. for availability date. ? development tool is available on select devices.
pic16c717/770/771 ds41120b-page 146 ? 2002 microchip technology inc. notes:
? 2002 microchip technology inc. ds41120b-page 147 pic16c717/770/771 15.0 electrical characteristics absolute maximum ratings ? ambient temperature under bias................................................................................................. ............... .-55 to +125 c storage temperature ............................................................................................................ .................. -65 c to +150 c voltage on any pin with respect to v ss (except v dd , mclr and ra4) .......................................... -0.3v to (v dd + 0.3v) voltage on v dd with respect to v ss ............................................................................................................ -0.3 to +7.5v maximum voltage between av dd and v dd pins ................................................................................................................. 0.3v maximum voltage between av ss and v ss pins ................................................................................................................. 0.3v voltage on mclr with respect to v ss ........................................................................................................ -0.3v to +8.5v voltage on ra4 with respect to vss ............................................................................................. ............ -0.3v to +10.5v total power dissipation (note 1) ............................................................................................................................... 1.0w maximum current out of v ss pin ........................................................................................................................... 300 ma maximum current into v dd pin ........................................................................................................................... ...250 ma input clamp current, i ik (v i < 0 or v i > v dd ) ..................................................................................................................... 20 ma output clamp current, i ok (v o < 0 or v o > v dd ) ............................................................................................................. 20 ma maximum output current sunk by any i/o pin..................................................................................... .....................25 ma maximum output current sourced by any i/o pin .................................................................................. ..................25 ma maximum current sunk by porta and portb (combined).................................................................................200 ma maximum current sourced by porta and portb (combined) .......................................................................... .200 ma note 1: power dissipation is calculated as follows: pdis = v dd x {i dd - i oh } + {(v dd - v oh ) x i oh } + (v o l x i ol ). ? notice: stresses above those listed under ? absolute maximum ratings ? may cause permanent damage to the device. this is a stress rating only and functional operation of the device at those or any other conditions above those indicated in the operation listings of this specification is not implied. exposure to maximum rating conditions for extended periods may affect device reliability.
pic16c717/770/771 ds41120b-page 148 ? 2002 microchip technology inc. figure 15-1: pic16c717/770/771 voltage-frequency graph, -40 c t a +85 c figure 15-2: pic16lc717/770/771 voltage-frequency graph, 0 c t a +70 c 6.0 2.5 4.0 3.0 0 3.5 4.5 5.0 5.5 410 frequency (mhz) v dd 20 (volts) 25 note 1: the shaded region indicates the permissible combinations of voltage and frequency. 6.0 2.5 4.0 3.0 0 3.5 4.5 5.0 5.5 410 frequency (mhz) v dd 20 (volts) 25 note 1: the shaded region indicates the permissible combinations of voltage and frequency.
? 2002 microchip technology inc. ds41120b-page 149 pic16c717/770/771 figure 15-3: pic16lc717/770/771 voltage-frequency graph, -40 c t a 0 c, +70 c t a +85 c 6.0 2.5 4.0 3.0 0 3.5 4.5 5.0 5.5 410 frequency (mhz) v dd 20 (volts) 25 note 1: the shaded region indicates the permissible combinations of voltage and frequency.
pic16c717/770/771 ds41120b-page 150 ? 2002 microchip technology inc. 15.1 dc characteristics: pic16c717/770/771 (commercial, industrial, extended) pic16lc717/770/771 (commercial, industrial, extended) pic16lc717/770/771 standard operating conditions (unless otherwise stated) operating temperature 0 c t a +70 c for commercial -40 c t a +85 c for industrial -40 c t a +125 c for extended pic16c717/770/771 standard operating conditions (unless otherwise stated) operating temperature 0 c t a +70 c for commercial -40 c t a +85 c for industrial -40 c t a +125 c for extended param. no. sym characteristic min typ ? max units conditions d001 v dd supply voltage 2.5 ? 5.5 v d001 v dd supply voltage 4.0 ? 5.5 v d002* v dr ram data retention voltage (1) ? 1.5 ? v d002* v dr ram data retention voltage (1) ? 1.5 ? v d003* v por v dd start voltage to ensure internal power- on reset signal ? v ss ? v see section on power-on reset for details d003* v por v dd start voltage to ensure internal power- on reset signal ? v ss ? v see section on power-on reset for details d004* s vdd v dd rise rate to ensure internal power-on reset signal 0.05 ?? v/ms see section on power-on reset for details. pwrt enabled d004* s vdd v dd rise rate to ensure internal power-on reset signal 0.05 ? ? v/ms see section on power-on reset for details. pwrt enabled * these parameters are characterized but not tested. ? data in "typ" column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: this is the limit to which v dd can be lowered without losing ram data.
? 2002 microchip technology inc. ds41120b-page 151 pic16c717/770/771 15.1 dc characteristics: pic16c717/770/771 (commercial, industrial, extended) pic16lc717/770/771 (commercial, industrial, extended) (continued) pic16lc717/770/771 standard operating conditions (unless otherwise stated) operating temperature 0 c t a +70 c for commercial -40 c t a +85 c for industrial -40 c t a +125 c for extended pic16c717/770/771 standard operating conditions (unless otherwise stated) operating temperature 0 c t a +70 c for commercial -40 c t a +85 c for industrial -40 c t a +125 c for extended param. no. sym characteristic min typ ? max units conditions i dd supply current (2) d010d d010e d010g d010k pic16lc7xx 1.0 0.36 11 2.0 3.0 1.0 45 ma ma a f osc = 10 mhz, v dd = 3v, -40 c to 85 c f osc = 10 mhz, v dd = 3v, -40 c to 125 c f osc = 4 mhz, v dd = 2.5v, -40 c to 125 c f osc = 32 khz, v dd = 2.5v, -40 c to 125 c i dd supply current (2) d010 d010a d010b d010c d010f d010h d010j pic16c7xx 4.0 2.5 0.55 30 7.5 12.0 5.0 6.0 1.5 80 95 ma ma ma a f osc = 20 mhz, v dd = 5.5v, -40 c to 85 c f osc = 20 mhz, v dd = 5.5v, -40 c to 125 c f osc = 20 mhz, v dd = 4v, -40 c to 85 c f osc = 20 mhz, v dd = 4v, -40 c to 125 c f osc = 4 mhz, v dd = 4v, -40 c to 125 c f osc = 32 khz, v dd = 4v, -40 c to 85 c f osc = 32 khz, v dd = 4v, -40 c to 125 c * these parameters are characterized but not tested. ? data in "typ" column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: this is the limit to which v dd can be lowered without losing ram data. 2: the supply current is mainly a function of the operating voltage and frequency. other factors such as i/o pin loading and switching rate, oscillator type, internal code execution pattern, and temperature also have an impact on the current consumption. the test conditions for all i dd measurements in active operation mode are: osc1 = external square wave, from rail to rail; all i/o pins tristated, pulled to v dd mclr = v dd ; wdt enabled/disabled as specified.
pic16c717/770/771 ds41120b-page 152 ? 2002 microchip technology inc. i pd power-down current (3) d020d d020e d020f d020g pic16lc7xx 0.3 0.1 2.0 5.0 1.5 3.0 a a v dd = 3v, -40 c to 85 c v dd = 3v, -40 c to 125 c v dd = 2.5v, -40 c to 85 c v dd = 2.5v, -40 c to 125 c d020 d020a d020b d020c pic16c7xx 1.4 1.0 4.0 8.0 3.5 6.0 a a v dd = 5.5v, -40 c to 85 c v dd = 5.5v, -40 c to 125 c v dd = 4v, -40 c to 85 c v dd = 4v, -40 c to 125 c * these parameters are characterized but not tested. ? data in "typ" column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: this is the limit to which v dd can be lowered without losing ram data. 2: the supply current is mainly a function of the operating voltage and frequency. other factors such as i/o pin loading and switching rate, oscillator type, internal code execution pattern, and temperature also have an impact on the current consumption. the test conditions for all i dd measurements in active operation mode are: osc1 = external square wave, from rail to rail; all i/o pins tristated, pulled to v dd mclr = v dd ; wdt enabled/disabled as specified. 3: the power-down current in sleep mode does not depend on the oscillator type. power-down current is measured with the part in sleep mode, with all i/o pins in hi-impedance state and tied to v dd or v ss . pic16lc717/770/771 standard operating conditions (unless otherwise stated) operating temperature 0 c t a +70 c for commercial -40 c t a +85 c for industrial -40 c t a +125 c for extended pic16c717/770/771 standard operating conditions (unless otherwise stated) operating temperature 0 c t a +70 c for commercial -40 c t a +85 c for industrial -40 c t a +125 c for extended param. no. sym characteristic min typ ? max units conditions
? 2002 microchip technology inc. ds41120b-page 153 pic16c717/770/771 15.1 dc characteristics: pic16c717/770/771 (commercial, industrial, extended) pic16lc717/770/771 (commercial, industrial, extended) (continued) pic16lc717/770/771 standard operating conditions (unless otherwise stated) operating temperature 0 c t a +70 c for commercial -40 c t a +85 c for industrial -40 c t a +125 c for extended pic16c717/770/771 standard operating conditions (unless otherwise stated) operating temperature 0 c t a +70 c for commercial -40 c t a +85 c for industrial -40 c t a +125 c for extended param. no. sym characteristic min typ ? max units conditions base plus module current d021a i wdt watchdog timer 2 10 av dd = 3v, -40 c to 125 c d021 i wdt watchdog timer 5 20 a v dd = 4v, -40 c to 125 c d021 i wdt watchdog timer 5 20 av dd = 4v, -40 c to 125 c d025 i t 1 osc timer1 oscillator 3 9 av dd = 3v, -40 c to 125 c d025 i t 1 osc timer1 oscillator 4 12 a v dd = 4v, -40 c to 125 c d025 i t 1 osc timer1 oscillator 4 12 av dd = 4v, -40 c to 125 c d026* i ad adc converter 300 a v dd = 5.5v, a/d on, not converting d026* i ad adc converter 300 av dd = 5.5v, a/d on, not converting d027 d027a i plvd programmable low voltage detect 55 125 150 a v dd = 4v, -40 c to 85 c v dd = 4v, -40 c to 125 c d027 d027a i plvd programmable low voltage detect 55 125 150 av dd = 4v, -40 c to 85 c v dd = 4v, -40 c to 125 c d028 d028a i pbor programmable brown- out reset 55 125 150 a v dd = 5v, -40 c to 85 c v dd = 5v, -40 c to 125 c d028 d028a i pbor programmable brown- out reset 55 125 150 av dd = 5v, -40 c to 85 c v dd = 5v, -40 c to 125 c d029 d029a i vrh voltage reference high 200 750 1.0 a ma v dd = 5v, -40 c to 85 c v dd = 5v, -40 c to 125 c d029 d029a i vrh voltage reference high 200 750 1.0 a ma v dd = 5v, -40 c to 85 c v dd = 5v, -40 c to 125 c d030 d030a i vrl voltage reference low 200 750 1.0 a ma v dd = 4v, -40 c to 85 c v dd = 4v, -40 c to 125 c d030 d030a i vrl voltage reference low 200 750 1.0 a ma v dd = 4v, -40 c to 85 c v dd = 4v, -40 c to 125 c * these parameters are characterized but not tested. ? data in "typ" column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested.
pic16c717/770/771 ds41120b-page 154 ? 2002 microchip technology inc. 15.2 dc characteristics: pic16c717/770/771 & pic16lc717/770/771 (commercial, industrial, extended) dc characteristics standard operating conditions (unless otherwise stated) operating temperature 0 c t a +70 c for commercial -40 c t a +85 c for industrial -40 c t a +125 c for extended operating voltage v dd range as described in section 15.1 and section 15.2. param. no. sym characteristic min typ ? max units conditions input low voltage v il i/o ports d030 with ttl buffer v ss ? 0.15v dd v for entire v dd range d030a v ss ? 0.8v v 4.5v v dd 5.5v d031 with schmitt trigger buffer v ss ? 0.2v dd v for entire v dd range d032 mclr v ss ? 0.2v dd v d033 osc1 (in xt, hs, lp and ec) v ss ? 0.3v dd v input high voltage v ih i/o ports ? d040 with ttl buffer 2.0 ? v dd v4.5v v dd 5.5v d040a (0.25v dd + 0.8v) ? v dd v for entire v dd range d041 with schmitt trigger buffer 0.8v dd ? v dd v for entire v dd range d042 mclr 0.8v dd ? v dd v d042a osc1 (xt, hs, lp and ec) 0.7v dd ? v dd v d070 i purb portb weak pull-up current per pin 50 250 400 av dd = 5v, v pin = v ss input leakage current (1,2) d060 i il i/o ports (with digital functions) ?? 1 avss v pin v dd , pin at hi-impedance d060a i il i/o ports (with analog func- tions) ?? 100 na vss v pin v dd , pin at hi-impedance d061 ra5/mclr /v pp ?? 5 avss v pin v dd d063 osc1 ?? 5 avss v pin v dd , xt, hs, lp and ec osc configuration output low voltage d080 v ol i/o ports ?? 0.6 v i ol = 8.5 ma, v dd = 4.5v output high voltage d090 v oh i/o ports (2) v dd - 0.7 ?? vi oh = -3.0 ma, v dd = 4.5v d150* v od open drain high voltage ?? 10.5 v ra4 pin capacitive loading specs on output pins* d100 cos c2 osc2 pin ?? 15 pf in xt, hs and lp modes when exter- nal clock is used to drive osc1. d101 d102 c io c b all i/o pins and osc2 (in rc mode) scl, sda in i 2 c mode ? ? ? ? 50 400 pf pf c vrh v rh pin ?? 200 pf v rh output enabled c vrl v rl pin ?? 200 pf v rl output enabled * these parameters are characterized but not tested. ? data in ? typ ? column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: the leakage current on the mclr pin is strongly dependent on the applied voltage level. the specified levels represent normal operating conditions. higher leakage current may be measured at different input voltages. 2: negative current is defined as current sourced by the pin.
? 2002 microchip technology inc. ds41120b-page 155 pic16c717/770/771 15.3 ac characteristics: pic16c717/770/771 & pic16lc717/770/771 (commercial, industrial, extended) 15.3.1 timing parameter symbology the timing parameter symbols have been created using one of the following formats: 1. tpps2pps 3. t cc : st (i 2 c specifications only) 2. tpps 4. ts (i 2 c specifications only) t f frequency t time lowercase letters (pp) and their meanings: pp cc ccp1 osc osc1 ck clkout rd rd cs cs rw rd or wr di sdi sc sck do sdo ss ss dt data in t0 t0cki io i/o port t1 t1cki mc mclr wr wr uppercase letters and their meanings: s ffall pperiod hhigh rrise i invalid (hi-impedance) v valid l low z hi-impedance i 2 c (i 2 c specifications only) aa output access buf bus free high high low low t cc : st (i 2 c specifications only) cc hd hold su setup st dat data input hold sto stop condition sta start condition
pic16c717/770/771 ds41120b-page 156 ? 2002 microchip technology inc. figure 15-4: load conditions v dd /2 c l r l pin pin v ss v ss c l r l =464 ? c l =50 pf for all pins except osc2 15 pf for osc2 output load condition 1 load condition 2
? 2002 microchip technology inc. ds41120b-page 157 pic16c717/770/771 15.3.2 timing diagrams and specifications figure 15-5: clkout and i/o timing table 15-1: clkout and i/o timing requirements param. no. sym characteristic min typ ? max unit s conditions 12* tckr clkout rise time ? 35 100 ns note 1 13* tckf clkout fall time ? 35 100 ns note 1 14* tckl2iov clkout to port out valid ?? 0.5t cy + 20 ns note 1 15* tiov2ckh port in valid before clkout 0.25t cy + 25 ?? ns note 1 16* tckh2ioi port in hold after clkout 0 ?? ns note 1 17* tosh2iov osc1 (q1 cycle) to port out valid ? 50 150 ns 18* tosh2ioi osc1 (q2 cycle) to port input invalid (i/o in hold time) pic16 c 717/770/771 100 ?? ns pic16 lc 717/770/771 200 ?? ns 19* tiov2osh port input valid to osc1 (i/o in setup time) 0 ?? ns 20* tior port output rise time pic16 c 717/770/771 ? 10 25 ns pic16 lc 717/770/771 ?? 60 ns 21* tiof port output fall time pic16 c 717/770/771 ? 10 25 ns pic16 lc 717/770/771 ?? 60 ns 22 ?? * tinp int pin high or low time t cy ?? ns 23 ?? * trbp rb<7:0> change int high or low time t cy ?? ns * these parameters are characterized but not tested. ? data in "typ" column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. ?? these parameters are asynchronous events not related to any internal clock edges. note 1: measurements are taken er or intrc w/clkout mode where clkout output is 4 x t osc . note: refer to figure 15-4 for load conditions. osc1 clkout (1) i/o pin (input) i/o pin (output) q4 q1 q2 q3 13 14 17 20, 21 19 18 15 12 16 old value new value
pic16c717/770/771 ds41120b-page 158 ? 2002 microchip technology inc. figure 15-6: external clock timing osc1 q4 q1 q2 q3 q4 q1 1 2 3 3 4 4 table 15-2: external clock timing requirements param no. sym characteristic min typ ? max units conditions 1a f osc external clkin frequency (note 1) dc ? 4 mhz xt mode dc ? 20 mhz ec mode dc ? 20 mhz hs mode dc ? 200 khz lp mode oscillator frequency (note 1) 0.1* ? 4 mhz xt mode 4* 5* ? ? 20 200 mhz khz hs mode lp mode 1t osc external clkin period (note 1) 250 ?? ns xt mode 50 ?? ns ec mode 50 ?? ns hs mode 5 ?? s lp mode oscillator period (note 1) 250 ? 10,000* ns xt mode 50 ? 250* ns hs mode 5 ?? s lp mode 2t cy instruction cycle time (note 1) 200 t cy dc ns t cy = 4/f osc 3* tosl, to s h external clock in (osc1) high or low time 100 ?? ns xt mode 2.5 ?? s lp mode 15 ?? ns hs mode ec mode 4* tosr, to s f external clock in (osc1) rise or fall time ? ? 25 ns xt mode ? ? 50 ns lp mode ?? 15 ns hs mode ec mode * these parameters are characterized but not tested. ? data in "typ" column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: instruction cycle period (t cy ) equals four times the input oscillator time-base period. all specified values are based on characterization data for that particular oscillator type under standard operating conditions with the device executing code. exceeding these specified limits may result in an unstable oscillator operation and/or higher than expected current con- sumption. all devices are tested to operate at "max. frequency" values with a square wave applied to the osc1/clkin pin. when an external clock input is used, the "min." frequency (or max. t cy ) limit is "dc" (no clock) for all devices.
? 2002 microchip technology inc. ds41120b-page 159 pic16c717/770/771 table 15-3: calibrated internal rc frequencies - pic16c717/770/771 and pic16lc717/770/771 figure 15-7: reset, watchdog timer, oscillator start-up timer and power-up timer timing figure 15-8: brown-out reset timing ac characteristics standard operating conditions (unless otherwise specified) operating temperature 0 c t a +70 c for commercial -40 c t a +85 c for industrial -40 c t a +125 c for extended operating voltage v dd range is described in section and section parameter no. sym characteristic min typ (1)* max units conditions f irc internal calibrated rc frequency 3.65 4.00 4.28 mhz v dd = 5.0v internal rc frequency* 3.55 4.00 4.31 mhz v dd = 2.5v * these parameters are characterized but not tested. note 1: data in the typical ( ? typ ? ) column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. v dd mclr internal por pwrt time-out osc time-out internal reset watchdog timer reset 33 32 30 31 34 i/o pins 34 note: refer to figure 15-4 for load conditions. v dd v bor 35
pic16c717/770/771 ds41120b-page 160 ? 2002 microchip technology inc. table 15-4: reset, watchdog timer, oscillator start-up timer, power-up timer, and brown-out reset requirements figure 15-9: brown-out reset characteristics figure 15-10: timer0 and timer1 external clock timings parameter no. sym characteristic min typ ? max units conditions 30* t mcl mclr pulse width (low) 2 ?? sv dd = 5v, -40 c to +85 c 31* t wdt watchdog timer time-out period (no prescaler) 71833msv dd = 5v, -40 c to +85 c 32* t ost oscillation start-up timer period ? 1024 t osc ?? t osc = osc1 period 33* t pwrt power up timer period 28 72 132 ms v dd = 5v, -40 c to +85 c 34* t ioz i/o hi-impedance from mclr low or watchdog timer reset ?? 2.1 s 35* t bor brown-out reset pulse width 100 ?? sv dd v bor (d005) * these parameters are characterized but not tested. ? data in "typ" column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. v bor reset (due to bor) v dd (device in brown-out reset) (device not in brown-out reset) 72 ms time-out note: refer to figure 15-4 for load conditions. 46 47 45 48 41 42 40 ra4/t0cki rb6/t1oso/t1cki/pic tmr0 or tmr1
? 2002 microchip technology inc. ds41120b-page 161 pic16c717/770/771 table 15-5: timer0 and timer1 external clock requirements figure 15-11: enhanced capture/compare/pwm timings (eccp) param. no. sym characteristic min typ ? max units conditions 40* tt0h t0cki high pulse width no prescaler 0.5t cy + 20 ?? ns must also meet parameter 42 with prescaler 10 ?? ns 41* tt0l t0cki low pulse width no prescaler 0.5t cy + 20 ?? ns must also meet parameter 42 with prescaler 10 ?? ns 42* tt0p t0cki period no prescaler t cy + 40 ?? ns with prescaler greater of: 20 or t cy + 40 n ?? ns n = prescale value (2, 4, ..., 256) 45* tt1h t1cki high time synchronous, prescaler = 1 0.5t cy + 20 ?? ns must also meet parameter 47 synchronous, prescaler = 2,4,8 pic16 c 717/770/771 15 ?? ns pic16 lc 717/770/771 25 ?? ns asynchronous pic16 c 717/770/771 30 ?? ns pic16 lc 717/770/771 50 ?? ns 46* tt1l t1cki low time synchronous, prescaler = 1 0.5t cy + 20 ?? ns must also meet parameter 47 synchronous, prescaler = 2,4,8 pic16 c 717/770/771 15 ?? ns pic16 lc 717/770/771 25 ?? ns asynchronous pic16 c 717/770/771 30 ?? ns pic16 lc 717/770/771 50 ?? ns 47* tt1p t1cki input period synchronous pic16 c 717/770/771 greater of : 30 or t cy + 40 n ?? ns n = prescale value (1, 2, 4, 8) pic16 lc 717/770/771 greater of : 50 or t cy + 40 n ?? ns n = prescale value (1, 2, 4, 8) asynchronous pic16 c 717/770/771 60 ?? ns pic16 lc 717/770/771 100 ?? ns ft1 timer1 oscillator input frequency range (oscillator enabled by setting bit t1oscen) dc ? 50 khz 48 tcke2tmr1 delay from external clock edge to timer increment 2tosc ? 7tosc ? * these parameters are characterized but not tested. ? data in "typ" column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note: refer to figure 15-4 for load conditions. rb3/ccp1/p1a (capture mode) 50 51 52 53 54 rb3/ccp1/p1a (compare or pwm mode)
pic16c717/770/771 ds41120b-page 162 ? 2002 microchip technology inc. table 15-6: enhanced capture/compare/pwm requirements (eccp) param. no. sym characteristic min typ ? max units conditions 50* tccl ccp1 input low time no prescaler 0.5t cy + 20 ?? ns with prescaler pic16 c 717/770/771 10 ?? ns pic16 lc 717/770/771 20 ?? ns 51* tcch ccp1 input high time no prescaler 0.5t cy + 20 ?? ns with prescaler pic16 c 717/770/771 10 ?? ns pic16 lc 717/770/771 20 ?? ns 52* tccp ccp1 input period 3t cy + 40 n ?? ns n = prescale value (1, 4 or 16) 53* tccr ccp1 output fall time pic16 c 717/770/771 ? 10 25 ns pic16 lc 717/770/771 ? 25 45 ns 54* tccf ccp1 output fall time pic16 c 717/770/771 ? 10 25 ns pic16 lc 717/770/771 ? 25 45 ns * these parameters are characterized but not tested. ? data in "typ" column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested.
? 2002 microchip technology inc. ds41120b-page 163 pic16c717/770/771 15.4 analog peripherals characteristics: pic16c717/770/771 & pic16lc717/770/771 (commercial, industrial, extended) 15.4.1 bandgap module figure 15-12: bandgap start-up time table 15-7: bandgap start-up time param. no. sym characteristic min typ ? max units conditions 36* t bgap bandgap start-up time ? 19 33 s defined as the time between the instant that the bandgap is enabled and the moment that the bandgap reference voltage is stable. * these parameters are characterized but not tested. ? data in "typ" column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. v bgap = 1.2v v bgap enable bandgap bandgap stable t bgap (internal use only)
pic16c717/770/771 ds41120b-page 164 ? 2002 microchip technology inc. 15.4.2 low voltage detect module (lvd) figure 15-13: low voltage detect characteristics table 15-8: electrical characteristics: lvd dc characteristics standard operating conditions (unless otherwise stated) operating temperature -40 c t a +85 c for industrial and 0 c t a +70 c for commercial operating voltage v dd range as described in dc characteristics section 15.1. param. no. characteristic symbol min typ ? max units conditions d420* lvd voltage lvv = 0100 v lvd 2.5 2.58 2.66 v lvv = 0101 2.7 2.78 2.86 v lvv = 0110 2.8 2.89 2.98 v lvv = 0111 3.0 3.1 3.2 v lvv = 1000 3.3 3.41 3.52 v lvv = 1001 3.5 3.61 3.72 v lvv = 1010 3.6 3.72 3.84 v lvv = 1011 3.8 3.92 4.04 v lvv = 1100 4.0 4.13 4.26 v lvv = 1101 4.2 4.33 4.46 v lvv = 1110 4.5 4.64 4.78 v * these parameters are characterized but not tested. note 1: production tested at tamb = 25 c. specifications over temperature limits ensured by characterization. v lvd lvdif v dd (lvdif set by hardware) (lvdif can be cleared in software anytime during the gray area)
? 2002 microchip technology inc. ds41120b-page 165 pic16c717/770/771 15.4.3 programmable brown-out reset module (pbor) table 15-9: dc characteristics: pbor 15.4.4 v ref module table 15-10: dc characteristics: v ref dc characteristics standard operating conditions (unless otherwise stated) operating temperature 0c t a +70c for commercial -40c t a +85c for industrial -40c t a +125c for extended operating voltage v dd range as described in dc characteristics section 15.1. param. no. characteristic symbol min typ max units conditions d005 bor voltage borv<1:0> = 11 v bor 2.5 2.58 2.66 v borv<1:0> = 10 2.7 2.78 2.86 borv<1:0> = 01 4.2 4.33 4.46 borv<1:0> = 00 4.5 4.64 4.78 dc characteristics standard operating conditions (unless otherwise stated) operating temperature 0c t a +70c for commercial -40c t a +85c for industrial -40c t a +125c for extended operating voltage v dd range as described in dc characteristics section 15.1. param. no. symbol characteristic min typ? max units conditions d400 vrl output voltage 2.0 2.048 2.1 v v dd 2.7v, -40 c t a +85 c vrh 4.0 4.096 4.2 v v dd 4.5v, -40 c t a +85 c d400a vrl output voltage 1.9 2.048 2.2 v v dd 2.7v, -40 c t a +125 c vrh 4.0 4.096 4.3 v v dd 4.5v, -40 c t a +125 c d404* i vrefso external load source ?? 5ma d405* i vrefsi external load sink ?? -5 ma * cl external capacitor load ?? 200 pf d406* ? vout/ ? iout vrh load regulation ? 0.6 1 mv/ma v dd 5v i source = 0 ma to 5 ma ? 14 i sink = 0 ma to 5 ma vrl load regulation ? 0.6 1 v dd 3v i source = 0 ma to 5 ma ? 24 i sink = 0 ma to 5 ma * these parameters are characterized but not tested. ? data in ? typ ? column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested.
pic16c717/770/771 ds41120b-page 166 ? 2002 microchip technology inc. 15.4.5 a/d converter module table 15-11: pic16c770/771 and pic16lc770/771 a/d converter characteristics : param. no. sym characteristic min typ ? max units conditions a01 n r resolution ?? 12 bits bit min. resolution for a/d is 1 mv, v ref + = av dd = 4.096v, v ref - = av ss = 0v, v ref - v ain v ref + a03 e il integral error ?? 2 lsb v ref + = av dd = 4.096v, v ref - = av ss = 0v, v ref - v ain v ref + a04 e dl differential error ?? +2 -1 lsb no missing codes to 12 bits v ref + = av dd = 4.096v, v ref - = av ss = 0v, v ref - v ain v ref + a06 e off offset error ?? 2 lsb v ref + = av dd = 4.096v, v ref - = av ss = 0v, v ref - v ain v ref + a07 e gn gain error ?? 2 lsb v ref + = av dd = 4.096v, v ref - = av ss = 0v, v ref - v ain v ref + a10 ? monotonicity ? note 3 ?? av ss v ain v ref + a20* v ref reference voltage (v ref + - v ref -) 4.096 ? v dd +0.3v v absolute minimum electrical spec to ensure 12-bit accuracy. a21* v ref + reference v high (a vdd or v ref +) v ref - ? av dd v min. resolution for a/d is 1 mv a22* v ref - reference v low (a vss or v ref -) av ss ? v ref + v min. resolution for a/d is 1 mv a25* v ain analog input volt- age v refl ? v refh v a30* z ain recommended impedance of ana- log voltage source ?? 2.5 k ? a50* i ref v ref input current (note 2) ?? 10 a during v ain acquisition. based on differential of v hold to v ain . to c h a r g e c hold see section 11.0. during a/d conversion cycle. * these parameters are characterized but not tested. ? data in ? typ ? column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: when a/d is off, it will not consume any current other than minor leakage current. the power-down current spec includes any such leakage from the a/d module. 2: v ref input current is from external v ref +, or v ref -, or av ss , or av dd pin, whichever is selected as refer- ence input. 3: the a/d conversion result never decreases with an increase in the input voltage and has no missing codes.
? 2002 microchip technology inc. ds41120b-page 167 pic16c717/770/771 figure 15-14: pic16c770/771 and pic16lc770/771 a/d conversion timing (normal mode) 131 130 132 bsf adcon0, go q4 a/d clk a/d data adres adif go sample old_data sampling stopped new_data 11 10 9 3 2 1 0 note 1: if the a/d rc clock source is selected, a time of t cy is added before the a/d clock starts. this allows the sleep instruction to be executed. 1/2 t cy 8 134 done
pic16c717/770/771 ds41120b-page 168 ? 2002 microchip technology inc. table 15-12: pic16c770/771 and pic16lc770/771 a/d conversion requirements (normal mode) parameter no. sym characteristic min typ ? max units conditions 130* (3) t ad a/d clock period 1.6 ?? s tosc based, v ref 2.5v 3.0 ?? s tosc based, v ref full range 3.0 6.0 9.0 s adcs<1:0> = 11 (a/d rc mode) at v dd = 2.5v 2.0 4.0 6.0 sat v dd = 5.0v 131* t cnv conversion time (not including acquisition time) (note 1) ? 13t ad ? t ad 132* t acq acquisition time note 2 5* 11.5 ? ? ? s s the minimum time is the ampli- fier settling time. this may be used if the ? new ? input voltage has not changed by more than 1lsb (i.e., 1mv @ 4.096v) from the last sampled voltage (as stated on c hold ). 134* t go q4 to a/d clock start ? t osc /2 ?? * these parameters are characterized but not tested. ? data in ? typ ? column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: adres register may be read on the following t cy cycle. 2: see section 11.6 for minimum conditions. 3: these numbers multiplied by 8 if v rh or v rl is selected as a/d reference.
? 2002 microchip technology inc. ds41120b-page 169 pic16c717/770/771 figure 15-15: pic16c770/771 and pic16lc770/771 a/d conversion timing (sleep mode) table 15-13: pic16c770/771 and pic16lc770/771 a/d conversion requirement (sleep mode) parameter no. sym characteristic min typ ? max units conditions 130* (3) t ad a/d internal rc oscillator period 3.0 6.0 9.0 s adcs<1:0> = 11 (rc mode) at v dd = 3.0v 2.0 4.0 6.0 sat v dd = 5.0v 131* t cnv conversion time (not including acquisition time) (note 1) ? 13t ad ?? 132* t acq acquisition time (note 2) 5* 11.5 ? ? ? s s the minimum time is the amplifier settling time. this may be used if the ? new ? input voltage has not changed by more than 1lsb (i.e., 1mv @ 4.096v) from the last sam- pled voltage (as stated on c hold ). 134* t go q4 to a/d clock start ? t osc /2 + t cy ?? if the a/d clock source is selected as rc, a time of t cy is added before the a/d clock starts. this allows the sleep instruction to be executed. * these parameters are characterized but not tested. ? data in ? typ ? column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: adres register may be read on the following t cy cycle. 2: see section 11.6 for minimum conditions. 3: these numbers multiplied by 8 if v rh or v rl is selected as a/d reference. 131 130 bsf adcon0, go q4 a/d clk a/d data adres adif go sample old_data sampling stopped new_data 11 9 3 2 1 0 note 1: if the a/d rc clock source is selected, a time of t cy is added before the a/d clock starts. this allows the sleep instruction to be executed. 134 8 10 132 done
pic16c717/770/771 ds41120b-page 170 ? 2002 microchip technology inc. table 15-14: pic16c717 and pic16lc717 a/d converter characteristics : param. no. sym characteristic min typ ? max units conditions a01 n r resolution ?? 10 bits bit min. resolution for a/d is 4.1 mv, v ref + = av dd = 4.096v, v ref - = av ss = 0v, v ref - v ain v ref + a03 e il integral error ?? 1 lsb v ref + = av dd = 4.096v, v ref - = av ss = 0v, v ref - v ain v ref + a04 e dl differential error ?? 1 lsb no missing codes to 10 bits v ref + = av dd = 4.096v, v ref - = av ss = 0v, v ref - v ain v ref + a06 e off offset error ?? 2 lsb v ref + = av dd = 4.096v, v ref - = av ss = 0v, v ref - v ain v ref + a07 e gn gain error ?? 1 lsb v ref + = av dd = 4.096v, v ref - = av ss = 0v, v ref - v ain v ref + a10 ? monotonicity ? note 3 ?? av ss v ain v ref + a20* v ref reference voltage (v ref + - v ref -) 4.096 ? v dd +0.3v v absolute minimum electrical spec to ensure 10-bit accuracy. a21* v ref + reference v high (a vdd or v ref +) v ref - ? av dd v min. resolution for a/d is 4.1 mv a22* v ref - reference v low (a vss or v ref -) av ss ? v ref + v min. resolution for a/d is 4.1 mv a25* v ain analog input voltage v refl ? v refh v a30* z ain recommended impedance of analog voltage source ?? 2.5 k ? a50* i ref v ref input current (note 2) ?? 10 a during v ain acquisition. based on differential of v hold to v ain . to charge c hold see section 11.0 . during a/d conversion cycle. * these parameters are characterized but not tested. ? data in ? typ ? column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: when a/d is off, it will not consume any current other than leakage current. the power-down current spec includes any such leakage from the a/d module. 2: v ref current is from external v ref +, or v ref -, or av ss , or av dd pin, whichever is selected as reference input. 3: the a/d conversion result never decreases with an increase in the input voltage and has no missing codes.
? 2002 microchip technology inc. ds41120b-page 171 pic16c717/770/771 figure 15-16: pic16c717 a/d conversion timing (normal mode) table 15-15: pic16c717 and pic16lc717 a/d conversion requirement (normal mode) parameter no. sym characteristic min typ ? max units conditions 130* (3) t ad a/d clock period 1.6 ?? s tosc based, v ref 2.5v 3.0 ?? s tosc based, v ref full range 3.0 6.0 9.0 s adcs<1:0> = 11 (a/d rc mode) at v dd = 2.5v 2.0 4.0 6.0 sat v dd = 5.0v 131* t cnv conversion time (not including acquisition time) (note 1) ? 11t ad ? t ad 132* t acq acquisition time (note 2) 5* 11.5 ? ? ? s s the minimum time is the amplifier settling time. this may be used if the ? new ? input voltage has not changed by more than 1lsb (i.e., 1mv @ 4.096v) from the last sam- pled voltage (as stated on c hold ). 134* t go q4 to a/d clock start ? t osc /2 ?? * these parameters are characterized but not tested. ? data in ? typ ? column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: adres register may be read on the following t cy cycle. 2: see section 11.6 for minimum conditions. 3: these numbers multiplied by 8 if v rh or v rl is selected as a/d reference. 131 130 132 bsf adcon0, go q4 a/d clk a/d data adres adif go sample old_data sampling stopped new_data 987 3210 note 1: if the a/d rc clock source is selected, a time of t cy is added before the a/d clock starts. this allows the sleep instruction to be executed. 1/2 t cy 6 134 done
pic16c717/770/771 ds41120b-page 172 ? 2002 microchip technology inc. figure 15-17: pic16c717 a/d conversion timing (sleep mode) table 15-16: pic16c717 and pic16lc717 a/d conversion requirement (sleep mode) parameter no. sym characteristic min typ ? max units conditions 130* (3) t ad a/d clock period 3.0 6.0 9.0 s adcs<1:0> = 11 (a/d rc mode) at v dd = 3.0v 2.0 4.0 6.0 sat v dd = 5.0v 131* t cnv conversion time (not including acquisition time) (note 1) ? 11t ad ?? 132* t acq acquisition time (note 2) 5* 11.5 ? ? ? s s the minimum time is the amplifier settling time. this may be used if the ? new ? input voltage has not changed by more than 1lsb (i.e., 1mv @ 4.096v) from the last sam- pled voltage (as stated on c hold ). 134* t go q4 to a/d clock start ? t osc /2 + t cy ?? if the a/d rc clock source is selected, a time of t cy is added before the a/d clock starts. this allows the sleep instruction to be executed. * these parameters are characterized but not tested. ? data in ? typ ? column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: adres register may be read on the following t cy cycle. 2: see section 11.6 for minimum conditions. 3: these numbers multiplied by 8 if v rh or v rl is selected as a/d reference. 131 130 bsf adcon0, go q4 a/d clk a/d data adres adif go sample old_data sampling stopped done new_data 9 7 3210 note 1: if the a/d rc clock source is selected, a time of t cy is added before the a/d clock starts. this allows the sleep instruction to be executed. 134 6 8 132
? 2002 microchip technology inc. ds41120b-page 173 pic16c717/770/771 15.5 master ssp spi mode timing waveforms and requirements figure 15-18: spi master mode timing (cke = 0) table 15-17: spi mode requirements (master mode, cke = 0) param. no. symbol characteristic min typ ? max units conditions 70* tssl2sch, tssl2scl ss to sck or sck input t cy ?? ns 71* tsch sck input high time (slave mode) continuous 1.25t cy + 30 ?? ns 71a* single byte 40 ?? ns note 1 72* tscl sck input low time (slave mode) continuous 1.25t cy + 30 ?? ns 72a* single byte 40 ?? ns note 1 73* tdiv2sch, tdiv2scl setup time of sdi data input to sck edge 100 ?? ns 73a* t b 2 b last clock edge of byte1 to the 1st clock edge of byte2 1.5t cy + 40 ?? ns note 1 74* tsch2dil, ts c l 2 d i l hold time of sdi data input to sck edge 100 ?? ns 75* tdor sdo data output rise time pic16 c xxx ? 10 25 ns pic16 lc xxx ? 20 45 ns 76* tdof sdo data output fall time ? 10 25 ns 78* tscr sck output rise time (master mode) pic16 c xxx ? 10 25 ns pic16 lc xxx ? 20 45 ns 79* tscf sck output fall time (master mode) ? 10 25 ns 80* tsch2dov, tscl2dov sdo data output valid after sck edge pic16 c xxx ?? 50 ns pic16 lc xxx ?? 100 ns * these parameters are characterized but not tested. ? data in ? typ ? column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: specification 73a is only required if specifications 71a and 72a are used. ss sck (ckp = 0) sck (ckp = 1) sdo sdi 70 71 72 73 74 75, 76 78 79 80 79 78 msb lsb bit6 - - - - - -1 msb in lsb in bit6 - - - -1 note: refer to figure 15-4 for load conditions.
pic16c717/770/771 ds41120b-page 174 ? 2002 microchip technology inc. figure 15-19: spi master mode timing (cke = 1) table 15-18: spi mode requirements (master mode, cke = 1) param. no. symbol characteristic min typ ? max units conditions 71* tsch sck input high time (slave mode) continuous 1.25t cy + 30 ?? ns 71a* single byte 40 ?? ns note 1 72* tscl sck input low time (slave mode) continuous 1.25t cy + 30 ?? ns 72a* single byte 40 ?? ns note 1 73* tdiv2sch, tdiv2scl setup time of sdi data input to sck edge 100 ?? ns 73a* t b 2 b last clock edge of byte1 to the 1st clock edge of byte2 1.5t cy + 40 ?? ns note 1 74* tsch2dil, ts c l 2 d i l hold time of sdi data input to sck edge 100 ?? ns 75* tdor sdo data output rise time pic16 c xxx ? 10 25 ns pic16 lc xxx 20 45 ns 76* tdof sdo data output fall time ? 10 25 ns 78* tscr sck output rise time (master mode) pic16 c xxx ? 10 25 ns pic16 lc xxx 20 45 ns 79* tscf sck output fall time (master mode) ? 10 25 ns 80* tsch2dov, tscl2dov sdo data output valid after sck edge pic16 c xxx ?? 50 ns pic16 lc xxx ? 100 ns 81* tdov2sch, tdov2scl sdo data output setup to sck edge t cy ?? ns * these parameters are characterized but not tested. ? data in ? typ ? column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: specification 73a is only required if specifications 71a and 72a are used. ss sck (ckp = 0) sck (ckp = 1) sdo sdi 81 71 72 74 75, 76 78 80 msb 79 73 msb in bit6 - - - - - -1 lsb in bit6 - - - -1 lsb note: refer to figure 15-4 for load conditions.
? 2002 microchip technology inc. ds41120b-page 175 pic16c717/770/771 figure 15-20: spi slave mode timing (cke = 0) table 15-19: spi mode requirements (slave mode timing (cke = 0) param. no. symbol characteristic min typ ? max units conditions 70* tssl2sch, tssl2scl ss to sck or sck input t cy ?? ns 71* tsch sck input high time (slave mode) continuous 1.25t cy + 30 ?? ns 71a* single byte 40 ?? ns note 1 72* tscl sck input low time (slave mode) continuous 1.25t cy + 30 ?? ns 72a* single byte 40 ?? ns note 1 73* tdiv2sch, tdiv2scl setup time of sdi data input to sck edge 100 ?? ns 73a* t b 2 b last clock edge of byte1 to the 1st clock edge of byte2 1.5t cy + 40 ?? ns note 1 74* tsch2dil, tscl2dil hold time of sdi data input to sck edge 100 ?? ns 75* tdor sdo data output rise time pic16 c xxx ? 10 25 ns pic16 lc xxx 20 45 ns 76* tdof sdo data output fall time ? 10 25 ns 77* tssh2doz ss to sdo output hi-impedance 10 ? 50 ns 78* tscr sck output rise time (master mode) pic16 c xxx ? 10 25 ns pic16 lc xxx 20 45 ns 79* tscf sck output fall time (master mode) ? 10 25 ns 80* tsch2dov, tscl2dov sdo data output valid after sck edge pic16 c xxx ?? 50 ns pic16 lc xxx ? 100 ns 83* tsch2ssh, tscl2ssh ss after sck edge 1.5t cy + 40 ?? ns * these parameters are characterized but not tested. ? data in ? typ ? column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: specification 73a is only required if specifications 71a and 72a are used. ss sck (ckp = 0) sck (ckp = 1) sdo sdi 70 71 72 73 74 75, 76 77 78 79 80 79 78 sdi msb lsb bit6 - - - - - -1 msb in bit6 - - - -1 lsb in 83 note: refer to figure 15-4 for load conditions.
pic16c717/770/771 ds41120b-page 176 ? 2002 microchip technology inc. figure 15-21: spi slave mode timing (cke = 1) table 15-20: spi slave mode requirements (cke = 1) param. no. symbol characteristic min typ ? max units conditions 70* tssl2sch, tssl2scl ss to sck or sck input t cy ?? ns 71* tsch sck input high time (slave mode) continuous 1.25t cy + 30 ?? ns 71a* single byte 40 ?? ns note 1 72* tscl sck input low time (slave mode) continuous 1.25t cy + 30 ?? ns 72a* single byte 40 ?? ns note 1 73a* t b 2 b last clock edge of byte1 to the 1st clock edge of byte2 1.5t cy + 40 ?? ns note 1 74* tsch2dil, tscl2dil hold time of sdi data input to sck edge 100 ?? ns 75* tdor sdo data output rise time pic16 c xxx ? 10 25 ns pic16 lc xxx 20 45 ns 76* tdof sdo data output fall time ? 10 25 ns 77* tssh2doz ss to sdo output hi-impedance 10 ? 50 ns 78* tscr sck output rise time (mas- ter mode) pic16 c xxx ? 10 25 ns pic16 lc xxx ? 20 45 ns 79* tscf sck output fall time (master mode) ? 10 25 ns 80* tsch2dov, tscl2dov sdo data output valid after sck edge pic16 c xxx ?? 50 ns pic16 lc xxx ?? 100 ns 82* tssl2dov sdo data output valid after ss edge pic16 c xxx ?? 50 ns pic16 lc xxx ?? 100 ns 83* tsch2ssh, tscl2ssh ss after sck edge 1.5t cy + 40 ?? ns * these parameters are characterized but not tested. ? data in ? typ ? column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: specification 73a is only required if specifications 71a and 72a are used. ss sck (ckp = 0) sck (ckp = 1) sdo sdi 70 71 72 82 sdi 74 75, 76 msb bit6 - - - - - -1 lsb 77 msb in bit6 - - - -1 lsb in 80 83 note: refer to figure 15-4 for load conditions.
? 2002 microchip technology inc. ds41120b-page 177 pic16c717/770/771 15.6 master ssp i 2 c mode timing waveforms and requirements figure 15-22: master ssp i 2 c bus start/stop bits timing waveforms table 15-21: master ssp i 2 c bus start/stop bits requirements figure 15-23: master ssp i 2 c bus data timing param. no. symbol characteristic min typ max units conditions 90* t su : sta start condition 100 khz mode 2(t osc )(brg + 1) ?? ns only relevant for a repeated start condition setup time 400 khz mode 2(t osc )(brg + 1) ?? 1 mhz mode (1) 2(t osc )(brg + 1) ?? 91* t hd : sta start condition 100 khz mode 2(t osc )(brg + 1) ?? ns after this period the first clock pulse is generated hold time 400 khz mode 2(t osc )(brg + 1) ?? 1 mhz mode (1) 2(t osc )(brg + 1) ?? 92* t su : sto stop condition 100 khz mode 2(t osc )(brg + 1) ?? ns setup time 400 khz mode 2(t osc )(brg + 1) ?? 1 mhz mode (1) 2(t osc )(brg + 1) ?? 93* t hd : sto stop condition 100 khz mode 2(t osc )(brg + 1) ?? ns hold time 400 khz mode 2(t osc )(brg + 1) ?? 1 mhz mode (1) 2(t osc )(brg + 1) ?? * these parameters are characterized but not tested. for the value required by the i 2 c specification, please refer to the picmi- cro tm mid-range mcu family reference manual (ds33023). maximum pin capacitance = 10 pf for all i 2 c pins. note: refer to figure 15-4 for load conditions. 91 93 scl sda start condition stop condition 90 92 note: refer to figure 15-4 for load conditions. 90 91 92 100 101 103 106 107 109 109 110 102 scl sda in sda out
pic16c717/770/771 ds41120b-page 178 ? 2002 microchip technology inc. table 15-22: master ssp i 2 c bus data requirements param. no. symbol characteristic min max units conditions 100* t high clock high time 100 khz mode 2(t osc )(brg + 1) ? ms 400 khz mode 2(t osc )(brg + 1) ? ms 1 mhz mode (1) 2(t osc )(brg + 1) ? ms 101* t low clock low time 100 khz mode 2(t osc )(brg + 1) ? ms 400 khz mode 2(t osc )(brg + 1) ? ms 1 mhz mode (1) 2(t osc )(brg + 1) ? ms 102* t r sda and scl rise time 100 khz mode ? 1000 ns cb is specified to be from 10 to 400 pf 400 khz mode 20 + 0.1cb 300 ns 1 mhz mode (1) ? 300 ns 103* t f sda and scl fall time 100 khz mode ? 300 ns cb is specified to be from 10 to 400 pf 400 khz mode 20 + 0.1cb 300 ns 1 mhz mode (1) ? 100 ns 90* t su : sta start condition setup time 100 khz mode 2(t osc )(brg + 1) ? ms only relevant for repeated start condition 400 khz mode 2(t osc )(brg + 1) ? ms 1 mhz mode (1) 2(t osc )(brg + 1) ? ms 91* t hd : sta start condition hold time 100 khz mode 2(t osc )(brg + 1) ? ms after this period the first clock pulse is generated 400 khz mode 2(t osc )(brg + 1) ? ms 1 mhz mode (1) 2(t osc )(brg + 1) ? ms 106* t hd : dat data input hold time 100 khz mode 0 ? ns 400 khz mode 0 0.9 ms 1 mhz mode (1) tbd ? ns 107* t su : dat data input setup time 100 khz mode 250 ? ns note 2 400 khz mode 100 ? ns 1 mhz mode (1) tbd ? ns 92* t su : sto stop condition setup time 100 khz mode 2(t osc )(brg + 1) ? ms 400 khz mode 2(t osc )(brg + 1) ? ms 1 mhz mode (1) 2(t osc )(brg + 1) ? ms 109* t aa output valid from clock 100 khz mode ? 3500 ns 400 khz mode ? 1000 ns 1 mhz mode (1) ?? ns 110 t buf bus free time 100 khz mode 4.7 ?? ms time the bus must be free before a new transmission can start 400 khz mode 1.3 ?? ms 1 mhz mode (1) tbd ?? ms d102 ? cb bus capacitive loading ? 400 pf * these parameters are characterized but not tested. for the value required by the i 2 c specification, please refer to the picmicro tm mid-range mcu family reference manual (ds33023). ? these parameters are for design guidance only and are not tested, nor characterized. note 1: maximum pin capacitance = 10 pf for all i 2 c pins. 2: a fast mode i 2 c bus device can be used in a standard mode i 2 c bus system, but (t su : dat ) 250 ns must then be met. this will automatically be the case if the device does not stretch the low period of the scl signal. if such a device does stretch the low period of the scl signal, it must output the next data bit to the sda line. [(t r )+(t su : dat ) = 1000 + 250 = 1250 ns], for 100 khz mode, before the scl line is released.
? 2002 microchip technology inc. ds41120b-page 179 pic16c717/770/771 16.0 dc and ac characteristics graphs and tables ? typical ? represents the mean of the distribution at 25 c. ? maximum ? or ? minimum ? represents (mean + 3 ) or (mean - 3 ) respectively, where is a standard deviation, over the whole temperature range. the f osc i dd was determined using an external sinusoidal clock source with a peak amplitude ranging from v ss to v dd . figure 16-1: maximum i dd vs. f osc over v dd (hs mode) the graphs and tables provided following this note are a statistical summary based on a limited number of samples and are provided for informational purposes only. the performance characteristics listed herein are not tested or guaranteed. in some graphs or tables, the data presented may be outside the specified operating range (e.g., outside specified power supply range) and therefore outside the warranted range. 0.0 1.0 2.0 3.0 4.0 5.0 6.0 4.00 6.00 8.00 10.00 12.00 14.00 16.00 18.00 20.00 f osc (mhz) i dd (ma) 5.5v 5.0v 4.5v 4.0v 3.5v 3.0v 2.5v
pic16c717/770/771 ds41120b-page 180 ? 2002 microchip technology inc. figure 16-2: typical i dd vs. f osc over v dd (hs mode) figure 16-3: maximum i dd vs. f osc over v dd (xt mode) 0.0 1.0 2.0 3.0 4.0 5.0 6.0 4.00 6.00 8.00 10.00 12.00 14.00 16.00 18.00 20.00 f osc (mhz) i dd (ma) 5.5v 4.0v 3.0v 2.5v 4.5v 3.5v 5.0v 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 0.00 0.50 1.00 1.50 2.00 2.50 3.00 3.50 4.00 f osc (mhz) i dd (ma) 5.5v 5.0v 4.5v 4.0v 3.5v 3.0v 2.5v
? 2002 microchip technology inc. ds41120b-page 181 pic16c717/770/771 figure 16-4: typical i dd vs. f osc over v dd (xt mode) figure 16-5: maximum i dd vs. f osc over v dd (lp mode) 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 0.00 0.50 1.00 1.50 2.00 2.50 3.00 3.50 4.00 f osc (mhz) i dd (ma) 5.5v 5.0v 4.5v 4.0v 3.5v 3.0v 2.5v 0.000 0.020 0.040 0.060 0.080 0.100 0.120 0.140 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 f osc (mhz) i dd (ma) 5.5v 5.0v 4.5v 4.0v 3.5v 3.0v 2.5v
pic16c717/770/771 ds41120b-page 182 ? 2002 microchip technology inc. figure 16-6: typical i dd vs. f osc over v dd (lp mode) figure 16-7: maximum i dd vs. f osc over v dd (ec mode) 0.000 0.020 0.040 0.060 0.080 0.100 0.120 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 f osc (mhz) i dd (ma) 5.5v 4.0v 3.0v 2.5v 4.5v 3.5v 5.0v 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 0.00 2.00 4.00 6.00 8.00 10.00 12.00 14.00 16.00 18.00 20.00 f osc (mhz) i dd (ma) 5.5v 5.0v 4.5v 4.0v 3.5v 3.0v 2.5v
? 2002 microchip technology inc. ds41120b-page 183 pic16c717/770/771 figure 16-8: typical i dd vs. f osc over v dd (ec mode) figure 16-9: maximum i dd vs. f osc over v dd (er mode) 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 0.00 2.00 4.00 6.00 8.00 10.00 12.00 14.00 16.00 18.00 20.00 f osc (mhz) i dd (ma) 5.5v 5.0v 4.5v 4.0v 3.5v 3.0v 2.5v 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) i dd (ma) r = 38.3 k ? r = 100 k ? r = 200 k ? r = 499 k ? r = 1 m ? r = 38.3 k ? r = 100 k ? r = 200 k ? r = 499 k ?
pic16c717/770/771 ds41120b-page 184 ? 2002 microchip technology inc. figure 16-10: typical i dd vs. f osc over v dd (er mode) figure 16-11: typical f osc vs. v dd (er mode) 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) i dd (ma) r = 38.3 k ? r = 100 k ? r = 200 k ? r = 499 k ? r = 1 m ? r = 38.3 k ? r = 100 k ? r = 200 k ? r = 499 k ? 0.1 1.0 10.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 vdd (v) frequency (mhz) r = 38.3 k ? r = 100 k ? r = 200 k ? r = 499 k ? r = 1 m ? r = 38.3 k ? r = 100 k ? r = 200 k ? r = 499 k ? v dd (v)
? 2002 microchip technology inc. ds41120b-page 185 pic16c717/770/771 figure 16-12: maximum i dd vs. v dd (intrc 37 khz mode) figure 16-13: typical i dd vs. v dd (intrc 37 khz mode) 0.00 0.10 0.20 0.30 0.40 0.50 0.60 0.70 0.80 0.90 1.00 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (volts) i dd (ma) typ (25 c) max (-40 c) 0.00 0.02 0.04 0.06 0.08 0.10 0.12 0.14 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) i dd (ma) -40 c 25 c 85 c 125 c
pic16c717/770/771 ds41120b-page 186 ? 2002 microchip technology inc. figure 16-14: internal rc f osc vs. v dd over temperature (37 khz) figure 16-15: maximum and typical i dd vs. v dd (intrc 4 mhz mode) 0.020 0.025 0.030 0.035 0.040 0.045 0.050 0.055 0.060 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) f osc (mhz) max (125 c) typ (25 c) min(-40 c) 0.4 0.6 0.8 1.0 1.2 1.4 1.6 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (volts) i dd (ma) max (-40 c) typ (25 c)
? 2002 microchip technology inc. ds41120b-page 187 pic16c717/770/771 figure 16-16: typical i dd vs. v dd (intrc 4 mhz mode) figure 16-17: internal rc f osc vs. v dd over temperature (4 mhz) 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (volts) i dd (ma) -40 c 25 c 85 c 125 c 3.80 3.85 3.90 3.95 4.00 4.05 4.10 4.15 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) f osc (mhz) max (125 c) typ (25 c) min (-40 c)
pic16c717/770/771 ds41120b-page 188 ? 2002 microchip technology inc. figure 16-18: maximum i pd vs. v dd (-40 c to +125 c) 0.01 0.1 1 10 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) i pd ( p a ) +125 c +85 c +25 c -40 c
? 2002 microchip technology inc. ds41120b-page 189 pic16c717/770/771 figure 16-19: typical and maximum ? i wdt vs. v dd (-40 c to +125 c) 0.0 2.0 4.0 6.0 8.0 10.0 12.0 14.0 16.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) ' i wdt ( p a) max (-40 c) typ (25 c)
pic16c717/770/771 ds41120b-page 190 ? 2002 microchip technology inc. figure 16-20: typical and maximum ? i tmr1 vs. v dd (32 khz, -40 c to +125 c) figure 16-21: typical and maximum ? i vrl vs. v dd (-40 c to +125 c) 10.0 30.0 50.0 70.0 90.0 110.0 130.0 150.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) ' i tmr1 ( p a) max (-40 c) typ (25 c) 150.0 170.0 190.0 210.0 230.0 250.0 270.0 290.0 310.0 330.0 350.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) ' i vrl ( p a) max (125 c) max (85 c) typ (25 c)
? 2002 microchip technology inc. ds41120b-page 191 pic16c717/770/771 figure 16-22: typical and maximum ? i vrh vs. v dd (-40 c to +125 c) figure 16-23: typical and maximum ? i lvd vs. v dd (-40 c to +125 c) (lvd trip = 3.0v) 200.0 220.0 240.0 260.0 280.0 300.0 320.0 340.0 360.0 380.0 4.5 5.0 5.5 v dd (v) ' i vrh ( p a) max (125 c) max (85 c) typ (25 c) 30.0 35.0 40.0 45.0 50.0 55.0 60.0 65.0 70.0 75.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) ' i lvd ( p a) max (125 c) max (85 c) typ (25 c)
pic16c717/770/771 ds41120b-page 192 ? 2002 microchip technology inc. figure 16-24: typical and maximum ? i lvd vs. v dd (-40 c to +125 c) (lvd trip = 4.5v) figure 16-25: typical and maximum ? i bor vs. v dd (-40 c to +125 c) (v bor = 2.5v) 30.0 35.0 40.0 45.0 50.0 55.0 60.0 65.0 70.0 75.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) ' i lvd ( p a) max (125 c) max (85 c) typ (25 c) 30.0 40.0 50.0 60.0 70.0 80.0 90.0 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) ' i bor ( p a) max (125 c) typ (25 c) max (125 c) typ (25 c) device in sleep device in reset indeterminate sleep reset
? 2002 microchip technology inc. ds41120b-page 193 pic16c717/770/771 figure 16-26: typical and maximum ? i bor vs. v dd (-40 c to +125 c) (v bor = 4.5v) figure 16-27: v ol vs. i ol (-40 c to +125 c, v dd = 3.0v) 30.0 50.0 70.0 90.0 110.0 130.0 150.0 170.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) ' i bor ( p a) max (125 c) typ (25 c) max (125 c) typ (25c) device in sleep device in reset indeterminate sleep reset 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 0.0 5.0 10.0 15.0 20.0 25.0 i ol (ma) v ol (v) min (-40 c) max (125 c) typ (25 c)
pic16c717/770/771 ds41120b-page 194 ? 2002 microchip technology inc. figure 16-28: v ol vs. i ol (-40 c to +125 c, v dd = 5.0v) figure 16-29: v oh vs. i oh (-40 c to +125 c, v dd = 3.0v) 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 0.0 5.0 10.0 15.0 20.0 25.0 i ol (ma) v ol (v) min (-40 c) max (125 c) typ (25 c) 0.5 1.0 1.5 2.0 2.5 3.0 -16.0 -14.0 -12.0 -10.0 -8.0 -6.0 -4.0 -2.0 0.0 i oh (ma) v oh (v) max (-40 c) min (125 c) typ (25 c)
? 2002 microchip technology inc. ds41120b-page 195 pic16c717/770/771 figure 16-30: v oh vs. i oh (-40 c to +125 c, v dd = 5.0v) figure 16-31: minimum and maximum v ih /v il vs. v dd (ttl input,-40 c to +125 c) 2.0 2.5 3.0 3.5 4.0 4.5 5.0 -25.0 -20.0 -15.0 -10.0 -5.0 0.0 i oh (ma) v oh (v) max (-40 c) min (125 c) typ (25 c) 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) v il / v ih (v) min (125 c) max (-40 c)
pic16c717/770/771 ds41120b-page 196 ? 2002 microchip technology inc. figure 16-32: minimum and maximum v ih /v il vs. v dd (st input,-40 c to +125 c) figure 16-33: typical, minimum and maximum wdt period vs. v dd (-40 c to +125 c) 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) v il / v ih (v) max high (125 c) min high (-40 c) max low (-40 c) min low (125 c) 10.0 15.0 20.0 25.0 30.0 35.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) wdt period (ms) max (125 c) typ (25 c) max (85 c) min (-40 c)
? 2002 microchip technology inc. ds41120b-page 197 pic16c717/770/771 17.0 packaging information 17.1 package marking information 18-lead soic xxxxxxxxxxxx yywwnnn xxxxxxxxxxxxxxxxx yywwnnn 18-lead pdip example pic16c717/p 9917017 xxxxxxxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxx yywwnnn 18-lead cerdip windowed pic16c717/jw example 9905017 xxxxxxxx 20-lead pdip example xxxxxxxxxxxxxxxxx yywwnnn pic16c770/p 9917017 xxxxxxxxxxxxxxxxx xxxxxxxxxxxx example 9910017 pic16c717/so legend: xx...x customer specific information* y year code (last digit of calendar year) yy year code (last 2 digits of calendar year) ww week code (week of january 1 is week ? 01 ? ) nnn alphanumeric traceability code note : in the event the full microchip part number cannot be marked on one line, it will be carried over to the next line thus limiting the number of available characters for customer specific information. * standard picmicro device marking consists of microchip part number, year code, week code, and traceability code. for picmicro device marking beyond this, certain price adders apply. please check with your microchip sales office. for qtp devices, any special marking adders are included in qtp price.
pic16c717/770/771 ds41120b-page 198 ? 2002 microchip technology inc. 17.1 package marking information (cont ? d) yywwnnn xxxxxxxxxxx xxxxxxxxxxx 20-lead ssop 9917017 20i/ss pic16c770 example xxxxxxxx yywwnnn 20-lead cerdip windowed pic16c770/jw example 9905017 xxxxxxxx 20-lead soic xxxxxxxxxxxxxxxxxxxxxxxx yywwnnn example pic16c771/so 9910017 xxxxxxxxxxxxxxxxxxxxxxxx
? 2002 microchip technology inc. ds41120b-page 199 pic16c717/770/771 17.2 18-lead plastic dual in-line (p) ? 300 mil (pdip) 15 10 5 15 10 5 mold draft angle bottom 15 10 5 15 10 5 mold draft angle top 10.92 9.40 7.87 .430 .370 .310 eb overall row spacing 0.56 0.46 0.36 .022 .018 .014 b lower lead width 1.78 1.46 1.14 .070 .058 .045 b1 upper lead width 0.38 0.29 0.20 .015 .012 .008 c lead thickness 3.43 3.30 3.18 .135 .130 .125 l tip to seating plane 22.99 22.80 22.61 .905 .898 .890 d overall length 6.60 6.35 6.10 .260 .250 .240 e1 molded package width 8.26 7.94 7.62 .325 .313 .300 e shoulder to shoulder width 0.38 .015 a1 base to seating plane 3.68 3.30 2.92 .145 .130 .115 a2 molded package thickness 4.32 3.94 3.56 .170 .155 .140 a top to seating plane 2.54 .100 p pitch 18 18 n number of pins max nom min max nom min dimension limits millimeters inches* units 1 2 d n e1 c eb e p a2 l b1 b a a1 * controlling parameter notes: dimensions d and e1 do not include mold flash or protrusions. mold flash or protrusions shall not exceed .010 ? (0.254mm) per side. jedec equivalent: ms-001 drawing no. c04-007 significant characteristic
pic16c717/770/771 ds41120b-page 200 ? 2002 microchip technology inc. 17.3 18-lead ceramic dual in-line with window (jw) ? 300 mil (cerdip) 3.30 3.56 3.81 5.33 5.08 4.83 .210 .200 .190 w2 window length .150 .140 .130 w1 window width 10.80 9.78 8.76 .425 .385 .345 eb overall row spacing 0.53 0.47 0.41 .021 .019 .016 b lower lead width 1.52 1.40 1.27 .060 .055 .050 b1 upper lead width 0.30 0.25 0.20 .012 .010 .008 c lead thickness 3.81 3.49 3.18 .150 .138 .125 l tip to seating plane 23.37 22.86 22.35 .920 .900 .880 d overall length 7.49 7.37 7.24 .295 .290 .285 e1 ceramic pkg. width 8.26 7.94 7.62 .325 .313 .300 e shoulder to shoulder width 0.76 0.57 0.38 .030 .023 .015 a1 standoff 4.19 4.06 3.94 .165 .160 .155 a2 ceramic package height 4.95 4.64 4.32 .195 .183 .170 a top to seating plane 2.54 .100 p pitch 18 18 n number of pins max nom min max nom min dimension limits millimeters inches* units 1 2 d n w2 e1 w1 c eb e p l a2 b b1 a a1 *controlling parameter jedec equivalent: mo-036 drawing no. c04-010
? 2002 microchip technology inc. ds41120b-page 201 pic16c717/770/771 17.4 18-lead plastic small outline (so) ? wide, 300 mil (soic) foot angle 048048 15 12 0 15 12 0 mold draft angle bottom 15 12 0 15 12 0 mold draft angle top 0.51 0.42 0.36 .020 .017 .014 b lead width 0.30 0.27 0.23 .012 .011 .009 c lead thickness 1.27 0.84 0.41 .050 .033 .016 l foot length 0.74 0.50 0.25 .029 .020 .010 h chamfer distance 11.73 11.53 11.33 .462 .454 .446 d overall length 7.59 7.49 7.39 .299 .295 .291 e1 molded package width 10.67 10.34 10.01 .420 .407 .394 e overall width 0.30 0.20 0.10 .012 .008 .004 a1 standoff 2.39 2.31 2.24 .094 .091 .088 a2 molded package thickness 2.64 2.50 2.36 .104 .099 .093 a overall height 1.27 .050 p pitch 18 18 n number of pins max nom min max nom min dimension limits millimeters inches* units l c h 45 1 2 d p n b e1 e a2 a1 a * controlling parameter notes: dimensions d and e1 do not include mold flash or protrusions. mold flash or protrusions shall not exceed .010 ? (0.254mm) per side. jedec equivalent: ms-013 drawing no. c04-051 significant characteristic
pic16c717/770/771 ds41120b-page 202 ? 2002 microchip technology inc. 17.5 20-lead plastic dual in-line (p) ? 300 mil (pdip) 15 10 5 15 10 5 mold draft angle bottom 15 10 5 15 10 5 mold draft angle top 10.92 9.40 7.87 .430 .370 .310 eb overall row spacing 0.56 0.46 0.36 .022 .018 .014 b lower lead width 1.65 1.52 1.40 .065 .060 .055 b1 upper lead width 0.38 0.29 0.20 .015 .012 .008 c lead thickness 3.56 3.30 3.05 .140 .130 .120 l tip to seating plane 26.42 26.24 26.04 1.040 1.033 1.025 d overall length 6.60 6.35 6.10 .260 .250 .240 e1 molded package width 8.26 7.87 7.49 .325 .310 .295 e shoulder to shoulder width 0.38 .015 a1 base to seating plane 3.68 3.30 2.92 .145 .130 .115 a2 molded package thickness 4.32 3.94 3.56 .170 .155 .140 a top to seating plane 2.54 .100 p pitch 20 20 n number of pins max nom min max nom min dimension limits millimeters inches* units 1 2 d n e1 c eb e p a2 l b1 b a a1 * controlling parameter notes: dimensions d and e1 do not include mold flash or protrusions. mold flash or protrusions shall not exceed .010 ? (0.254mm) per side. jedec equivalent: ms-001 drawing no. c04-019 significant characteristic
? 2002 microchip technology inc. ds41120b-page 203 pic16c717/770/771 17.6 20-lead ceramic dual in-line with window (jw) ? 300 mil (cerdip) drawing not available
pic16c717/770/771 ds41120b-page 204 ? 2002 microchip technology inc. 17.7 20-lead plastic small outline (so) ? wide, 300 mi (soic) * controlling parameter notes: dimensions d and e1 do not include mold flash or protrusions. mold flash or protrusions shall not exceed .010 ? (0.254mm) per side. jedec equivalent: ms-013 drawing no. c04-094 foot angle 048048 15 12 0 15 12 0 mold draft angle bottom 15 12 0 15 12 0 mold draft angle top 0.51 0.42 0.36 .020 .017 .014 b lead width 0.33 0.28 0.23 .013 .011 .009 c lead thickness 1.27 0.84 0.41 .050 .033 .016 l foot length 0.74 0.50 0.25 .029 .020 .010 h chamfer distance 13.00 12.80 12.60 .512 .504 .496 d overall length 7.59 7.49 7.39 .299 .295 .291 e1 molded package width 10.67 10.34 10.01 .420 .407 .394 e overall width 0.30 0.20 0.10 .012 .008 .004 a1 standoff 2.39 2.31 2.24 .094 .091 .088 a2 molded package thickness 2.64 2.50 2.36 .104 .099 .093 a overall height 1.27 .050 p pitch 20 20 n number of pins max nom min max nom min dimension limits millimeters inches* units h l c 45 1 2 d p n b e e1 a2 a a1 significant characteristic
? 2002 microchip technology inc. ds41120b-page 205 pic16c717/770/771 17.8 20-lead plastic shrink small outline (ss) ? 209 mil, 5.30 mm (ssop) 10 5 0 10 5 0 mold draft angle bottom 10 5 0 10 5 0 mold draft angle top 0.38 0.32 0.25 .015 .013 .010 b lead width 203.20 101.60 0.00 8 4 0 foot angle 0.25 0.18 0.10 .010 .007 .004 c lead thickness 0.94 0.75 0.56 .037 .030 .022 l foot length 7.34 7.20 7.06 .289 .284 .278 d overall length 5.38 5.25 5.11 .212 .207 .201 e1 molded package width 8.18 7.85 7.59 .322 .309 .299 e overall width 0.25 0.15 0.05 .010 .006 .002 a1 standoff 1.83 1.73 1.63 .072 .068 .064 a2 molded package thickness 1.98 1.85 1.73 .078 .073 .068 a overall height 0.65 .026 p pitch 20 20 n number of pins max nom min max nom min dimension limits millimeters inches* units 2 1 d p n b e e1 l c a2 a a1 * controlling parameter notes: dimensions d and e1 do not include mold flash or protrusions. mold flash or protrusions shall not exceed .010 ? (0.254mm) per side. jedec equivalent: mo-150 drawing no. c04-072 significant characteristic
pic16c717/770/771 ds41120b-page 206 ? 2002 microchip technology inc. notes:
? 2002 microchip technology inc. ds41120b-page 207 pic16c717/770/771 appendix a: revision history version date revision description a 09/14/99 this is a new data sheet. however, the devices described in this data sheet are the upgrades to the devices found in the pic16c7x data sheet , ds30390e. b 2/8/02 electrical characteristics tables completed and characteristics graphs added. mssp i 2 c (section 9.2) rewritten. general minor changes and corrections.
pic16c717/770/771 ds41120b-page 208 ? 2002 microchip technology inc. appendix b: device differences the differences between the devices in this data sheet are listed in table b-1. table b-1: device differences difference pic16c717 pic16c770 pic16c771 program memory 2k 2k 4k a/d 6 channels, 10 bits 6 channels, 12 bits 6 channels, 12 bits dedicated av dd and av ss not available available available packages 18-pin pdip, 18-pin windowed cerdip, 18-pin soic, 20-pin ssop 20-pin pdip, 20-pin windowed cerdip, 20-pin soic, 20-pin ssop 20-pin pdip, 20-pin windowed cerdip, 20-pin soic, 20-pin ssop
? 2002 microchip technology inc. ds41120b-page 209 pic16c717/770/771 index a a/d .................................................................................... 105 a/d converter enable (adie bit) ................................ 17 adcon0 register..................................................... 105 adcon1 register............................................. 105, 107 adres register ....................................................... 105 block diagram........................................................... 109 configuring analog port............................................ 108 conversion time ........................................................ 115 conversions .............................................................. 111 converter characteristics ................... 164, 165, 166, 170 faster conversion - lower resolution tradeoff ....... 115 internal sampling switch (rss) impedence .............. 113 operation during sleep ............................................ 116 sampling requirements............................................ 113 sampling time .......................................................... 113 source impedance.................................................... 113 special event trigger (eccp) .................................... 55 a/d conversion clock ....................................................... 110 ack ..................................................................................... 77 acknowledge data bit, akd ................................................ 69 acknowledge sequence enable bit, ake ........................... 69 acknowledge status bit, aks ............................................. 69 ackstat ........................................................................... 87 adcon0 register............................................................. 105 adcon1 register..................................................... 105, 107 adres.............................................................................. 105 adres register ........................................... 11, 12, 105, 116 akd..................................................................................... 69 ake..................................................................................... 69 aks..................................................................................... 69 analog-to-digital converter. see a/d application note an578, "use of the ssp module in the i2c multi-master environment." ............................. 84 architecture pic16c717/pic16c717 block diagram ....................... 5 pic16c770/771/pic16c770/771 block diagram ......... 6 assembler mpasm assembler................................................... 141 b banking, data memory ................................................... 9, 14 baud rate generator .......................................................... 84 bf ..................................................................... 66, 77, 87, 89 block diagrams baud rate generator.................................................. 84 i 2 c master mode......................................................... 83 i 2 c module .................................................................. 76 ra3:ra0 and ra5 port pins .................... 26, 28, 29, 35 ssp (i 2 c mode) .......................................................... 76 ssp (spi mode).......................................................... 70 bor. see brown-out reset brg .................................................................................... 84 brown-out reset (bor) .................................... 117, 123, 124 buffer full bit, bf ................................................................ 77 buffer full status bit, bf ..................................................... 66 bus arbitration .................................................................... 94 bus collision during a restart condition....................... 97 bus collision during a start condition ................................ 95 bus collision during a stop condition ................................ 98 bus collision section .......................................................... 94 c capture (eccp module)..................................................... 54 block diagram ............................................................ 54 ccpr1h:ccpr1l registers ..................................... 54 changing between capture prescalers ..................... 54 eccp pin configuration ............................................. 54 software interrupt ....................................................... 54 timer1 mode selection............................................... 54 capture/compare/pwm (eccp) capture mode. see capture compare mode. see compare pwm mode. see pwm ccp1con .......................................................................... 13 ccp2con .......................................................................... 13 ccpr1h register......................................................... 11, 13 ccpr1l register ............................................................... 13 ccpr2h register............................................................... 13 ccpr2l register ............................................................... 13 cke .................................................................................... 66 ckp .................................................................................... 67 clock polarity select bit, ckp............................................. 67 code examples loading the sspbuf register .................................... 71 code protection ........................................................ 117, 131 compare (eccp module)................................................... 54 block diagram ............................................................ 55 ccpr1h:ccpr1l registers ..................................... 54 eccp pin configuration ............................................. 54 software interrupt ....................................................... 55 special event trigger ........................................... 49, 55 timer1 mode selection............................................... 54 configuration bits ............................................................. 117 d d/a ...................................................................................... 66 data memory ........................................................................ 9 bank select (rp bits) ............................................. 9, 14 general purpose registers .......................................... 9 register file map ....................................................... 10 special function registers......................................... 11 data/address bit, d/a ......................................................... 66 dc characteristics pic16c717/770/771 ................................. 150, 151, 153 development support ....................................................... 141 device differences............................................................ 208 direct addressing ............................................................... 23 e enhanced capture/compare/pwm (eccp) ccp1 ccpr1h register .............................................. 53 ccpr1l register ............................................... 53 enable (ccp1ie bit)........................................... 17 timer resources ........................................................ 54 errata .................................................................................... 3 external power-on reset circuit....................................... 122 f firmware instructions ....................................................... 133 fsr register .......................................................... 11, 12, 13 g gce .................................................................................... 69 general call address sequence ........................................ 82 general call address support ............................................ 82 general call enable bit, gce ............................................. 69
pic16c717/770/771 ds41120b-page 210 ? 2002 microchip technology inc. i i/o ports .............................................................................. 25 i 2 c ....................................................................................... 76 i 2 c master mode reception................................................ 89 i 2 c master mode restart condition .................................... 86 i 2 c mode selection ............................................................. 76 i 2 c module acknowledge sequence timing ................................... 91 addressing .................................................................. 77 baud rate generator .................................................. 84 block diagram............................................................. 83 brg block diagram .................................................... 84 brg reset due to sda collision ................................ 96 brg timing ................................................................ 85 bus arbitration ............................................................ 94 bus collision ............................................................... 94 acknowledge....................................................... 94 restart condition ................................................ 97 restart condition timing (case1)....................... 97 restart condition timing (case2)....................... 97 start condition .................................................... 95 start condition timing .................................. 95, 96 stop condition .................................................... 98 stop condition timing (case1)........................... 98 stop condition timing (case2)........................... 98 transmit timing .................................................. 94 bus collision timing..................................................... 94 clock arbitration.......................................................... 93 clock arbitration timing (master transmit)................. 93 conditions to not give ack pulse ............................... 77 general call address support .................................... 82 master mode ............................................................... 83 master mode 7-bit reception timing ........................... 90 master mode operation .............................................. 84 master mode start condition ...................................... 85 master mode transmission......................................... 87 master mode transmit sequence ............................... 84 multi-master communication ...................................... 94 multi-master mode ...................................................... 84 operation .................................................................... 76 repeat start condition timing ..................................... 86 slave mode ................................................................. 76 slave reception .......................................................... 78 slave transmission..................................................... 80 sspbuf...................................................................... 76 stop condition receive or transmit timing................. 92 stop condition timing .................................................. 92 waveforms for 7-bit reception ................................... 78 waveforms for 7-bit transmission .............................. 80 i 2 c slave mode ................................................................... 76 icepic in-circuit emulator ............................................... 142 id locations .............................................................. 117, 131 in-circuit serial programming (icsp) ....................... 117, 131 indf.................................................................................... 13 indf register ............................................................... 11, 12 indirect addressing ............................................................. 23 fsr register ................................................................ 9 instruction format ............................................................. 133 instruction set ................................................................... 133 addlw ..................................................................... 135 addwf ..................................................................... 135 andlw ..................................................................... 135 andwf ..................................................................... 135 bcf ........................................................................... 135 bsf ........................................................................... 135 btfsc ...................................................................... 136 btfss ...................................................................... 136 call......................................................................... 136 clrf ........................................................................ 136 clrw ....................................................................... 136 clrwdt .................................................................. 136 comf ....................................................................... 137 decf ........................................................................ 137 decfsz ................................................................... 137 goto ....................................................................... 137 incf ......................................................................... 137 incfsz..................................................................... 137 iorlw ...................................................................... 138 iorwf...................................................................... 138 movf ....................................................................... 138 movlw .................................................................... 138 movwf .................................................................... 138 nop .......................................................................... 138 retfie ..................................................................... 139 retlw ..................................................................... 139 return................................................................... 139 rlf ........................................................................... 139 rrf .......................................................................... 139 sleep ...................................................................... 139 sublw ..................................................................... 140 subwf..................................................................... 140 swapf ..................................................................... 140 xorlw .................................................................... 140 xorwf .................................................................... 140 summary table ........................................................ 134 int interrupt (rb0/int). see interrupt sources intcon .............................................................................. 13 intcon register................................................................ 16 gie bit ........................................................................ 16 inte bit ...................................................................... 16 intf bit ...................................................................... 16 peie bit ...................................................................... 16 rbie bit ...................................................................... 16 rbif bit ................................................................ 16, 33 t0ie bit ....................................................................... 16 t0if bit ....................................................................... 16 inter-integrated circuit (i 2 c) ............................................... 65 internal sampling switch (rss) impedence ....................... 113 interrupt sources ...................................................... 117, 127 block diagram .......................................................... 127 capture complete (eccp) ......................................... 54 compare complete (eccp) ....................................... 55 rb0/int pin, external............................................... 128 tmr0 overflow................................................... 46, 128 tmr1 overflow..................................................... 47, 49 tmr2 to pr2 match ................................................... 52 tmr2 to pr2 match (pwm) ................................. 51, 56 interrupts synchronous serial port interrupt............................... 18 interrupts, context saving during..................................... 128 interrupts, enable bits a/d converter enable (adie bit)................................ 17 ccp1 enable (ccp1ie bit) .................................. 17, 54 global interrupt enable (gie bit) ........................ 16, 127 interrupt-on-change (rb7:rb4) enable (rbie bit)........................................................ 16, 128 peripheral interrupt enable (peie bit) ........................ 16 psp read/write enable (pspie bit) .......................... 17 rb0/int enable (inte bit) ......................................... 16 ssp enable (sspie bit) ............................................. 17 tmr0 overflow enable (t0ie bit) .............................. 16 tmr1 overflow enable (tmr1ie bit)......................... 17
? 2002 microchip technology inc. ds41120b-page 211 pic16c717/770/771 tmr2 to pr2 match enable (tmr2ie bit) ................. 17 usart receive enable (rcie bit) ...................... 17, 18 interrupts, flag bits ccp1 flag (ccp1if bit) ............................................. 54 interrupt on change (rb7:rb4) flag (rbif bit) .................................................. 16, 33, 128 rb0/int flag (intf bit).............................................. 16 tmr0 overflow flag (t0if bit) ........................... 16, 128 intrc mode ..................................................................... 120 k k ee l oq evaluation and programming tools .................... 144 l lvdcon ........................................................................... 101 m master clear (mclr ) mclr reset, normal operation ............... 121, 123, 124 mclr reset, sleep................................ 121, 123, 124 memory organization data memory ................................................................ 9 program memory .......................................................... 9 mplab c17 and mplab c18 c compilers...................... 141 mplab icd in-circuit debugger ...................................... 143 mplab ice high performance universal in-circuit emulator with mplab ide ............................................ 142 mplab integrated development environment software .. 141 mplink object linker/mplib object librarian ................ 142 multi-master communication .............................................. 94 multi-master mode .............................................................. 84 o opcode field descriptions ............................................. 133 option_reg register ...................................................... 15 intedg bit ................................................................. 15 ps bits .................................................................. 15, 45 psa bit.................................................................. 15, 45 rbpu bit..................................................................... 15 t0cs bit................................................................ 15, 45 t0se bit................................................................ 15, 45 oscillator configuration..................................................... 119 clkout ................................................................... 120 dual speed operation for er and intrc modes ....................................................... 120 ec ..................................................................... 119, 123 er ..................................................................... 119, 123 er mode ................................................................... 120 hs ..................................................................... 119, 123 intrc ............................................................... 119, 123 lp...................................................................... 119, 123 xt ..................................................................... 119, 123 oscillator, timer1 .......................................................... 47, 49 oscillator, wdt ................................................................. 129 p p.......................................................................................... 66 packaging ......................................................................... 197 paging, program memory ............................................... 9, 22 parallel slave port (psp) read/write enable (pspie bit)................................... 17 pcl register................................................................. 11, 12 pclath register ................................................... 11, 12, 13 pcon register ........................................................... 21, 123 picdem 1 low cost picmicro demonstration board .................................................... 143 picdem 17 demonstration board .................................... 144 picdem 2 low cost pic16cxx demonstration board .................................................... 143 picdem 3 low cost pic16cxxx demonstration board.................................................... 144 picstart plus entry level development programmer............................................ 143 pie1 register ..................................................................... 17 adie bit ...................................................................... 17 ccp1ie bit ................................................................. 17 pspie bit.................................................................... 17 rcie bit................................................................ 17, 18 sspie bit.................................................................... 17 tmr1ie bit ................................................................. 17 tmr2ie bit ................................................................. 17 pie2 register ..................................................................... 19 pinout descriptions pic16c770 ................................................................... 7 pic16c770/771 ............................................................ 7 pic16c771 ................................................................... 7 pir1 register ..................................................................... 18 pir2 register ..................................................................... 20 pointer, fsr ....................................................................... 23 por. see power-on reset porta ............................................................................... 13 initialization................................................................. 26 porta register......................................................... 25 trisa register........................................................... 25 porta register ......................................................... 11, 116 portb ............................................................................... 13 initialization................................................................. 33 portb register......................................................... 33 pull-up enable (rbpu bit).......................................... 15 rb0/int edge select (intedg bit) ........................... 15 rb0/int pin, external .............................................. 128 rb7:rb4 interrupt on change.................................. 128 rb7:rb4 interrupt on change enable (rbie bit)........................................................ 16, 128 rb7:rb4 interrupt on change flag (rbif bit).................................................. 16, 33, 128 trisb register........................................................... 33 portb register ......................................................... 11, 116 postscaler, timer2 select (toutps bits)................................................. 51 postscaler, wdt................................................................. 45 assignment (psa bit) ........................................... 15, 45 block diagram ............................................................ 46 rate select (ps bits)............................................ 15, 45 switching between timer0 and wdt......................... 46 power-down mode. see sleep power-on reset (por)..................... 117, 121, 122, 123, 124 oscillator start-up timer (ost)........................ 117, 122 power control (pcon) register............................... 123 power-down (pd bit) .................................................. 14 power-on reset circuit, external ............................. 122 power-up timer (pwrt) .................................. 117, 122 time-out (to bit)........................................................ 14 time-out sequence .................................................. 123 time-out sequence on power-up..................... 125, 126 pr2 register ...................................................................... 12 prescaler, capture.............................................................. 54 prescaler, timer0 ............................................................... 45 assignment (psa bit) ........................................... 15, 45 block diagram ............................................................ 46 rate select (ps bits)............................................ 15, 45 switching between timer0 and wdt......................... 46 prescaler, timer1 ............................................................... 48 select (t1ckps bits) ................................................. 47
pic16c717/770/771 ds41120b-page 212 ? 2002 microchip technology inc. prescaler, timer2................................................................ 57 select (t2ckps bits).................................................. 51 pro mate ii universal device programmer ................... 143 program counter pcl register............................................................... 22 pclath register ............................................... 22, 128 reset conditions....................................................... 123 program memory .................................................................. 9 interrupt vector ............................................................. 9 paging ..................................................................... 9, 22 program memory map .................................................. 9 read (pmr)............................................................... 43 reset vector ................................................................. 9 program verification.......................................................... 131 programmable brown-out reset (pbor) ................. 121, 122 programming, device instructions .................................... 133 pwm (ccp module) tmr2 to pr2 match ................................................... 51 tmr2 to pr2 match enable (tmr2ie bit) ................. 17 pwm (eccp module) ......................................................... 56 block diagram............................................................. 56 ccpr1h:ccpr1l registers...................................... 56 duty cycle................................................................... 57 output diagram........................................................... 57 period.......................................................................... 56 tmr2 to pr2 match ................................................... 56 q q clock ............................................................................... 57 r r/w ..................................................................................... 66 r/w bit ................................................................................ 80 r/w bit ................................................................................ 78 r/w bit ................................................................................ 77 ram. see data memory rce,receive enable bit, rce ............................................ 69 rcreg ............................................................................... 13 rcsta register.................................................................. 13 read/write bit, r/w ............................................................ 66 receive overflow indicator bit, sspov .............................. 67 refcon ........................................................................... 102 register file .......................................................................... 9 register file map ................................................................ 10 registers fsr summary ............................................................ 13 indf summary ........................................................... 13 intcon summary ...................................................... 13 pcl summary............................................................. 13 pclath summary ..................................................... 13 portb summary ....................................................... 13 sspstat............................................................ 66, 101 status summary ..................................................... 13 tmr0 summary .......................................................... 13 trisb summary ......................................................... 13 reset......................................................................... 117, 121 block diagram........................................................... 121 brown-out reset (bor). see brown-out reset (bor) mclr reset. see mclr power-on reset (por). see power-on reset (por) reset conditions for all registers ............................ 124 reset conditions for pcon register........................ 123 reset conditions for program counter ..................... 123 reset conditions for status register .................... 123 wdt reset. see watchdog timer (wdt) restart condition enabled bit, rse .................................... 69 revision history ................................................................ 207 rse..................................................................................... 69 s s ......................................................................................... 66 sae..................................................................................... 69 sck .................................................................................... 70 scl..................................................................................... 76 sda .................................................................................... 76 sdi...................................................................................... 70 sdo .................................................................................... 70 serial data in, sdi .............................................................. 70 serial data out, sdo ......................................................... 70 slave select synchronization ............................................. 73 slave select, ss ................................................................. 70 sleep .............................................................. 117, 121, 130 smp .................................................................................... 66 software simulator (mplab sim) .................................... 142 spe..................................................................................... 69 special event trigger. see compare special features of the cpu ............................................ 117 special function registers ................................................. 11 pic16c717 ................................................................. 11 pic16c717/770/771 ................................................... 11 pic16c770 ................................................................. 11 pic16c771 ................................................................. 11 speed, operating.................................................................. 1 spi master mode............................................................... 72 serial clock................................................................. 70 serial data in .............................................................. 70 serial data out ........................................................... 70 serial peripheral interface (spi) ................................. 65 slave select................................................................ 70 spi clock..................................................................... 72 spi mode .................................................................... 70 spi clock edge select, cke .............................................. 66 spi data input sample phase select, smp ....................... 66 spi master/slave connection............................................. 71 spi module master/slave connection............................................ 71 slave mode................................................................. 73 slave select synchronization ..................................... 73 slave synch timnig .................................................... 73 ss ....................................................................................... 70 ssp..................................................................................... 65 block diagram (spi mode) ......................................... 70 enable (sspie bit) ..................................................... 17 spi mode .................................................................... 70 sspadd ..................................................................... 77 sspbuf ............................................................... 72, 76 sspcon .................................................................... 67 sspcon2 ............................................................ 69, 70 sspsr ................................................................. 72, 77 sspstat ..................................................... 66, 76, 101 tmr2 output for clock shift................................. 51, 52 ssp i 2 c ssp i 2 c operation ..................................................... 76 ssp module spi master mode ........................................................ 72 spi master./slave connection.................................... 71 spi slave mode .......................................................... 73 sspcon1 register .................................................... 76 ssp overflow detect bit, sspov....................................... 77 sspadd register............................................................... 12 sspbuf ................................................................. 13, 76, 77 sspbuf register ............................................................... 11 sspcon............................................................................. 67 sspcon register .............................................................. 11
? 2002 microchip technology inc. ds41120b-page 213 pic16c717/770/771 sspcon1 ........................................................................... 76 sspcon2 ..................................................................... 69, 70 sspen ................................................................................ 67 sspif............................................................................ 18, 78 sspm .................................................................................. 68 sspov.................................................................... 67, 77, 89 sspstat.............................................................. 66, 76, 101 sspstat register ............................................................. 12 stack ................................................................................... 22 start bit (s).......................................................................... 66 start condition enabled bit, sae ........................................ 69 status register ................................................. 14, 15, 128 c bit ............................................................................ 14 dc bit.................................................................... 14, 15 irp bit......................................................................... 14 pd bit.......................................................................... 14 rp bits ........................................................................ 14 to bit.......................................................................... 14 z bit............................................................................. 14 status register ................................................................... 14 stop bit (p) .......................................................................... 66 stop condition enable bit ................................................... 69 synchronous serial port ..................................................... 65 synchronous serial port enable bit, sspen ...................... 67 synchronous serial port interrupt ....................................... 18 synchronous serial port mode select bits, sspm ............. 68 t t1con ................................................................................ 13 t1con register ........................................................... 13, 47 t1ckps bits ............................................................... 47 t1oscen bit.............................................................. 47 t1sync bit................................................................. 47 tmr1cs bit ................................................................ 47 tmr1on bit................................................................ 47 t2con register ........................................................... 13, 51 t2ckps bits ............................................................... 51 tmr2on bit................................................................ 51 toutps bits .............................................................. 51 timer0 block diagram............................................................. 45 clock source edge select (t0se bit)................... 15, 45 clock source select (t0cs bit)............................ 15, 45 overflow enable (t0ie bit) ......................................... 16 overflow flag (t0if bit)...................................... 16, 128 overflow interrupt ............................................... 46, 128 prescaler. see prescaler, timer0 timer1 ................................................................................. 47 block diagram............................................................. 48 capacitor selection..................................................... 49 clock source select (tmr1cs bit) ............................ 47 external clock input sync (t1sync bit) .................... 47 module on/off (tmr1on bit)..................................... 47 oscillator ............................................................... 47, 49 oscillator enable (t1oscen bit) ............................... 47 overflow enable (tmr1ie bit).................................... 17 overflow interrupt ................................................. 47, 49 prescaler. see prescaler, timer1 special event trigger (eccp) .............................. 49, 55 t1con register ......................................................... 47 tmr1h register ......................................................... 47 tmr1l register.......................................................... 47 timer2 block diagram ............................................................ 52 postscaler. see postscaler, timer2 pr2 register ........................................................ 51, 56 prescaler. see prescaler, timer2 ssp clock shift .................................................... 51, 52 t2con register ......................................................... 51 tmr2 register ........................................................... 51 tmr2 to pr2 match enable (tmr2ie bit) ................. 17 tmr2 to pr2 match interrupt......................... 51, 52, 56 timing diagrams acknowledge sequence timing ................................. 91 baud rate generator with clock arbitration............... 85 brg reset due to sda collision............................... 96 brown-out reset....................................................... 159 bus collision start condition timing ........................................ 95 bus collision during a restart condition (case 1).................................................................. 97 bus collision during a restart condition (case2)................................................................... 97 bus collision during a start condition (scl = 0) ................................................................ 96 bus collision during a stop condition........................ 98 bus collision for transmit and acknowledge ............. 94 capture/compare/pwm ........................................... 161 clkout and i/o ...................................................... 157 external clock timing............................................... 157 i 2 c bus data............................................................. 177 i 2 c master mode first start bit timing ........................ 85 i 2 c master mode reception timing............................. 90 i 2 c master mode transmission timing ....................... 88 master mode transmit clock arbitration .................... 93 power-up timer ........................................................ 159 repeat start condition ............................................... 86 reset ........................................................................ 159 slave synchronization ................................................ 73 start-up timer........................................................... 159 stop condition receive or transmit........................... 92 time-out sequence on power-up..................... 125, 126 timer0 ...................................................................... 160 timer1 ...................................................................... 160 wake-up from sleep via interrupt .......................... 131 watchdog timer ....................................................... 159 tmr0 .................................................................................. 13 tmr0 register.................................................................... 11 tmr1h ............................................................................... 13 tmr1h register ................................................................. 11 tmr1l ................................................................................ 13 tmr1l register.................................................................. 11 tmr2 .................................................................................. 13 tmr2 register.................................................................... 11 trisa register........................................................... 12, 116 trisb register........................................................... 12, 116 txreg ............................................................................... 13 u update address, ua ........................................................... 66 usart receive enable (rcie bit) ................................... 17, 18
pic16c717/770/771 ds41120b-page 214 ? 2002 microchip technology inc. w w register ........................................................................ 128 wake-up from sleep ............................................... 117, 130 interrupts ........................................................... 123, 124 mclr reset ............................................................. 124 timing diagram......................................................... 131 wdt reset ............................................................... 124 watchdog timer (wdt) ............................................ 117, 129 block diagram........................................................... 129 enable (wdte bit).................................................... 129 postscaler. see postscaler, wdt programming considerations ................................... 129 rc oscillator............................................................. 129 time-out period ........................................................ 129 wdt reset, normal operation ................. 121, 123, 124 wdt reset, sleep .......................................... 123, 124 waveform for general call address sequence .................. 82 wcol ................................................... 67, 85, 87, 89, 91, 92 wcol status flag .............................................................. 85 write collision detect bit, wcol ........................................ 67 www, on-line support........................................................ 3
? 2002 microchip technology inc. advance information ds41120b-page215 pic16c717/770/771 systems information and upgrade hot line the systems information and upgrade line provides system users a listing of the latest versions of all of microchip ? s development systems software products. plus, this line provides information on how customers can receive any currently available upgrade kits.the hot line numbers are: 1-800-755-2345 for u.s. and most of canada, and 1-480-792-7302 for the rest of the world. on-line support microchip provides on-line support on the microchip world wide web (www) site. the web site is used by microchip as a means to make files and information easily available to customers. to view the site, the user must have access to the internet and a web browser, such as netscape or microsoft explorer. files are also available for ftp download from our ftp site. connecting to the microchip internet web site the microchip web site is available by using your favorite internet browser to attach to: www.microchip.com the file transfer site is available by using an ftp ser- vice to connect to: ftp://ftp.microchip.com the web site and file transfer site provide a variety of services. users may download files for the latest development tools, data sheets, application notes, user ? s guides, articles and sample programs. a vari- ety of microchip specific business information is also available, including listings of microchip sales offices, distributors and factory representatives. other data available for consideration is:  latest microchip press releases  technical support section with frequently asked questions  design tips  device errata  job postings  microchip consultant program member listing  links to other useful web sites related to microchip products  conferences for products, development systems, technical information and more  listing of seminars and events 013001
pic16c717/770/771 ds41120b-page216 advance information ? 2002 microchip technology inc. reader response it is our intention to provide you with the best documentation possible to ensure successful use of your microchip prod- uct. if you wish to provide your comments on organization, clarity, subject matter, and ways in which our documentation can better serve you, please fax your comments to the technical publications manager at (480) 792-4150. please list the following information, and use this outline to provide us with your comments about this data sheet. 1. what are the best features of this document? 2. how does this document meet your hardware and software development needs? 3. do you find the organization of this data sheet easy to follow? if not, why? 4. what additions to the data sheet do you think would enhance the structure and subject? 5. what deletions from the data sheet could be made without affecting the overall usefulness? 6. is there any incorrect or misleading information (what and where)? 7. how would you improve this document? 8. how would you improve our software, systems, and silicon products? to : technical publications manager re: reader response total pages sent from: name company address city / state / zip / country telephone: (_______) _________ - _________ application (optional): would you like a reply? y n device: literature number: questions: fax: (______) _________ - _________ ds41120b pic16c717/770/771
? 2002 microchip technology inc. ds41120b-page 217 pic16c717/770/771 pic16c717/770/771 product identification system to order or obtain information, e.g., on pricing or delivery, refer to the factory or the listed sales office. * jw devices are uv erasable and can be programmed to any device configuration. jw devices meet the electrical requirement of each oscillator type. sales and support part no. x /xx xxx pattern package temperature range device device pic16c771 : v dd range 4.0v to 5.5v pic16c771t : v dd range 4.0v to 5.5v (tape/reel) pic16lc771 : v dd range 2.5v to 5.5v pic16lc771t: v dd range 2.5v to 5.5v (tape/reel) temperature range: -=0 c to +70 c i=-40 c to +85 c e=-40 c to +125 c package jw = windowed cerdip so = soic p=pdip ss = ssop pattern qtp, sqtp, code or special requirements . blank for otp and windowed devices. examples: a) pic16c771/p commercial temp., pdip package, normal v dd limits data sheets products supported by a preliminary data sheet may have an errata sheet describing minor operational differences and recom- mended workarounds. to determine if an errata sheet exists for a particular device, please contact one of the following: 1. your local microchip sales office 2. the microchip corporate literature center u.s. fax: (480) 792-7277 3. the microchip worldwide site (www.microchip.com) please specify which device, revision of silicon and data sheet (include literature #) you are using. new customer notification system register on our web site (www.microchip.com/cn) to receive the most current information on our products.
ds41120b-page 218 ? 2002 microchip technology inc. m americas corporate office 2355 west chandler blvd. chandler, az 85224-6199 tel: 480-792-7200 fax: 480-792-7277 technical support: 480-792-7627 web address: http://www.microchip.com rocky mountain 2355 west chandler blvd. chandler, az 85224-6199 tel: 480-792-7966 fax: 480-792-7456 atlanta 500 sugar mill road, suite 200b atlanta, ga 30350 tel: 770-640-0034 fax: 770-640-0307 boston 2 lan drive, suite 120 westford, ma 01886 tel: 978-692-3848 fax: 978-692-3821 chicago 333 pierce road, suite 180 itasca, il 60143 tel: 630-285-0071 fax: 630-285-0075 dallas 4570 westgrove drive, suite 160 addison, tx 75001 tel: 972-818-7423 fax: 972-818-2924 detroit tri-atria office building 32255 northwestern highway, suite 190 farmington hills, mi 48334 tel: 248-538-2250 fax: 248-538-2260 kokomo 2767 s. albright road kokomo, indiana 46902 tel: 765-864-8360 fax: 765-864-8387 los angeles 18201 von karman, suite 1090 irvine, ca 92612 tel: 949-263-1888 fax: 949-263-1338 new york 150 motor parkway, suite 202 hauppauge, ny 11788 tel: 631-273-5305 fax: 631-273-5335 san jose microchip technology inc. 2107 north first street, suite 590 san jose, ca 95131 tel: 408-436-7950 fax: 408-436-7955 toronto 6285 northam drive, suite 108 mississauga, ontario l4v 1x5, canada tel: 905-673-0699 fax: 905-673-6509 asia/pacific australia microchip technology australia pty ltd suite 22, 41 rawson street epping 2121, nsw australia tel: 61-2-9868-6733 fax: 61-2-9868-6755 china - beijing microchip technology consulting (shanghai) co., ltd., beijing liaison office unit 915 bei hai wan tai bldg. no. 6 chaoyangmen beidajie beijing, 100027, no. china tel: 86-10-85282100 fax: 86-10-85282104 china - chengdu microchip technology consulting (shanghai) co., ltd., chengdu liaison office rm. 2401, 24th floor, ming xing financial tower no. 88 tidu street chengdu 610016, china tel: 86-28-6766200 fax: 86-28-6766599 china - fuzhou microchip technology consulting (shanghai) co., ltd., fuzhou liaison office unit 28f, world trade plaza no. 71 wusi road fuzhou 350001, china tel: 86-591-7503506 fax: 86-591-7503521 china - shanghai microchip technology consulting (shanghai) co., ltd. room 701, bldg. b far east international plaza no. 317 xian xia road shanghai, 200051 tel: 86-21-6275-5700 fax: 86-21-6275-5060 china - shenzhen microchip technology consulting (shanghai) co., ltd., shenzhen liaison office rm. 1315, 13/f, shenzhen kerry centre, renminnan lu shenzhen 518001, china tel: 86-755-2350361 fax: 86-755-2366086 hong kong microchip technology hongkong ltd. unit 901-6, tower 2, metroplaza 223 hing fong road kwai fong, n.t., hong kong tel: 852-2401-1200 fax: 852-2401-3431 india microchip technology inc. india liaison office divyasree chambers 1 floor, wing a (a3/a4) no. 11, o ? shaugnessey road bangalore, 560 025, india tel: 91-80-2290061 fax: 91-80-2290062 japan microchip technology japan k.k. benex s-1 6f 3-18-20, shinyokohama kohoku-ku, yokohama-shi kanagawa, 222-0033, japan tel: 81-45-471- 6166 fax: 81-45-471-6122 korea microchip technology korea 168-1, youngbo bldg. 3 floor samsung-dong, kangnam-ku seoul, korea 135-882 tel: 82-2-554-7200 fax: 82-2-558-5934 singapore microchip technology singapore pte ltd. 200 middle road #07-02 prime centre singapore, 188980 tel: 65-334-8870 fax: 65-334-8850 taiwan microchip technology taiwan 11f-3, no. 207 tung hua north road taipei, 105, taiwan tel: 886-2-2717-7175 fax: 886-2-2545-0139 europe denmark microchip technology nordic aps regus business centre lautrup hoj 1-3 ballerup dk-2750 denmark tel: 45 4420 9895 fax: 45 4420 9910 france microchip technology sarl parc d ? activite du moulin de massy 43 rue du saule trapu batiment a - ler etage 91300 massy, france tel: 33-1-69-53-63-20 fax: 33-1-69-30-90-79 germany microchip technology gmbh gustav-heinemann ring 125 d-81739 munich, germany tel: 49-89-627-144 0 fax: 49-89-627-144-44 italy microchip technology srl centro direzionale colleoni palazzo taurus 1 v. le colleoni 1 20041 agrate brianza milan, italy tel: 39-039-65791-1 fax: 39-039-6899883 united kingdom arizona microchip technology ltd. 505 eskdale road winnersh triangle wokingham berkshire, england rg41 5tu tel: 44 118 921 5869 fax: 44-118 921-5820 01/18/02 w orldwide s ales and s ervice


▲Up To Search▲   

 
Price & Availability of PIC16C771T-ESS

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X